Forum Discussion

PrashantMaheshw's avatar
PrashantMaheshw
Qrew Captain
3 years ago

Can IF have multiple Yes / No actions ?

I've two variables in my formula being tested against a Single If condition 

Var text AB="";
Var text CD="";

// I'm currently writing two statements
If([XY]>0,$AB="good");
If([XY]>0,$CD="good") 

Is there a way to evaluate them in 1 sentence ?  Below is wrong of course 
If([XY]>0,$AB="good" and $CD="good") 


------------------------------
Prashant Maheshwari
------------------------------

4 Replies

  • There is infinite flexibility in the QuickBase formula language. If you can say in English what you want your logic to do then I can help you with the syntax.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • PrashantMaheshw's avatar
      PrashantMaheshw
      Qrew Captain
      OK I'm trying in plain English now :)

      1. My table has tasks which can come from three parent - Project Mgmt or GAP Mgmt
      2. I've to find the relevant parent and create RICH TEXT to point towards it
      3. I feel that I'm repeating IF multiple times , and maybe there is an efficient way to do the formula below

      ----
      // Name of the Parent
      var text Words =If([Related Project]>0,[Project Name],If([Related goal action plan]>0,[goal action plan],If([Related Template]>0,[Task Template Name],"")));

      var text pnametable = "brpsrk25s";
      var text gapnametable ="brn96mjz5";
      var text templatetable="brpsr2uua";

      // For defining the table name
      var text tablename = If([Related Project]>0,$pnametable,If([Related goal action plan]>0,$gapnametable,If([Related Template]>0,$templatetable)));

      // for definging the which project
      var number tablerecord = If([Related Project]>0,[Related Project],If([Related goal action plan]>0,[Related goal action plan],If([Related Template]>0,[Related Task Template])));

      var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;

      "<a href=" & $URL & ">" & $Words & "</a>"


      ā€‹

      ------------------------------
      Prashant Maheshwari
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        try this. unlike Excel you do not need to nest your IFs.  One IF is enough. 
        Also the result if none of the conditions is true is blank or null so there is no need for the empty quotes for the "else".



        // Name of the Parent

        var text Words =If(
        [Related Project]>0,[Project Name],
        [Related goal action plan]>0,[goal action plan],
        [Related Template]>0,[Task Template Name]);


        var text pnametable = "brpsrk25s";
        var text gapnametable ="brn96mjz5";
        var text templatetable="brpsr2uua";

        // For defining the table name
        var text tablename = If(
        [Related Project]>0,$pnametable,
        [Related goal action plan]>0,$gapnametable,
        [Related Template]>0,$templatetable);


        // for defining the which project
        var number tablerecord = If(
        [Related Project]>0,[Related Project],
        [Related goal action plan]>0,[Related goal action plan],
        [Related Template]>0,[Related Task Template]);


        var text URL = URLRoot() & "db/" & $tablename & "?a=dr&rid=" & $tablerecord;

        "<a href=" & $URL & ">" & $Words & "</a>"

        ------------------------------
        Mark Shnier (YQC)
        mark.shnier@gmail.com
        ------------------------------