Forum Discussion

SystemAdmin7's avatar
SystemAdmin7
Qrew Cadet
5 years ago
Solved

Adding If Statement to URL Formula

Hey all,
I wanted to know if anybody knows how to add an if statement to a URL formula with javascript?

Currently my formula looks like this:

var text url=URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&_fid_30=Sent&_fid_29=Sent&apptoken=XXXXX&rid=" & [Record ID#];

var text ifStatement=If([Submitted for Payroll Log] != "Sent" and [Commission for Homeowner] != 0, $url, " ");

"javascript:" &
"$.get('" &
$url &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"

Everything is working great except for the button is showing up still when the parameters: [Submitted for Payroll Log] != "Sent" and [Commission for Homeowner] != 0 are met when it shouldn't be.

------------------------------
Amanda
------------------------------
  • np
    var text url=URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&_fid_30=Sent&_fid_29=Sent&apptoken=XXXXX&rid=" & [Record ID#];

    If([Submitted for Payroll Log] != "Sent" and [Commission for Homeowner] != 0,

    "javascript:" &
    "$.get('" &
    $url &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);"

    ) //this is the closing bracket to the IF


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------

2 Replies

  • np
    var text url=URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&_fid_30=Sent&_fid_29=Sent&apptoken=XXXXX&rid=" & [Record ID#];

    If([Submitted for Payroll Log] != "Sent" and [Commission for Homeowner] != 0,

    "javascript:" &
    "$.get('" &
    $url &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);"

    ) //this is the closing bracket to the IF


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------
    • SystemAdmin7's avatar
      SystemAdmin7
      Qrew Cadet
      Worked like a charm! Thank you.

      ------------------------------
      Amanda Luna
      ------------------------------