Formula URL Button with Multiple variables

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
I wanted to incorporate If statements within a Formula URL button, so I created this:

var text URLONE = If([Task Name]="Baseball", URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xx&rid=" & [Task ID] & "&_fid_457=" & ToText(Today()) & "&_fid_277=" & URLEncode("Start")&"&_fid_348=Baseball task.");

var text URLONE = If([Task Name]="Basketball", URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xx&rid=" & [Task ID] & "&_fid_457=" & ToText(Today()) & "&_fid_277=" & URLEncode("Cancel")&"&_fid_348=Basketball task.");

var text URLTHREE= URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Task ID];

$URLONE & "&rdr=" & URLEncode($URLTHREE)

The button works and refreshes the record when the FIRST variable is satisfied but I can't get the second to work. I need it to work and refresh just like it does for the first variable.

Any ideas?
Photo of NP

NP

  • 10 Points

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
I'm surprised that passes a syntax test as you have declared URLONE twice.

You also need to URLEncode the words like



...._fid_348=Baseball task.");



it needs to be

_fid_348=" & URLEncode("Baseball task.");

because there are spaces in the text.
Photo of NP

NP

  • 10 Points
Oops, my mistake. The second is actually supposed to be:

var text URLONE
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
Maybee this is what you mean???


var text URLONE = If(

[Task Name]="Baseball", URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xx&rid=" & [Task ID] & "&_fid_457=" & ToText(Today()) & "&_fid_277=" & URLEncode("Start")&"&_fid_348=" & URLEncode("Baseball task."),

[Task Name]="Basketball", URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=xx&rid=" & [Task ID] & "&_fid_457=" & ToText(Today()) & "&_fid_277=" & URLEncode("Cancel")&"&_fid_348=" & URLEncode("Basketball task.");

var text URLTWO= URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Task ID];

$URLONE & "&rdr=" & URLEncode($URLTWO)
Photo of NP

NP

  • 10 Points
ah-ha! it works! thank you!