Forum Discussion

ThomasOtten1's avatar
Qrew Member
10 months ago

Formula URL to return if statement results?

Hi y'all,

So I'm deep in the weeds of creating a relatively complicated button via a formula URL, one that has a bunch of nested if statements. It's currently not working. However, rather than ask for help in debugging this one if statement - which might be helpful, but I'm sure I'd just run into a similar issue with a future button - I'd love a chunk of code that lets me feed an if statement as a $variable in, and pressing the button returns the results of that if statement (in a new tab, or a pop up window, or even writes it to a field, I don't mind as long as I can see the results).

For reference, my current URL formula is similar to this:

So there's 5 if statements. I'm getting an error with like result 3 not coming out how I want to, so I want to backtrack and see how condition1, condition 3, and condition 4 are outputing. For reference, the nested if is put into the variable "nestedIF" and piped to the button below:

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] & "&apptoken=[TOKEN]" & $nestedIF & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl())

Thomas Otten

1 Reply

  • Hi Thomas!

    If I understand your question correctly, then you can create a variable for nestedIF like this:
    var Text nestedIF = IF([condition A], [Result A], [Condition B],[Result B], [Result Z]);

    John Crosland