Calling two variables in a Formula URL Field

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered
I have a Formula URL field whose two formulas are as follows:

var text URLONE = "javascript:void(copyMasterDetailButtonHandler('&recurse=false&copyFid=117&destrid=0&sourcerid=" & [Record ID#] & "', 'mydbid'))"

and

var text URLTWO = "https://me.quickbase.com/db/homedbid?act=API_SetDBVar";
    & "&varname=" & URLEncode("lQnum")
    & If($da<>[lQda],
    "&value=" & URLEncode("02"),
    If(ToNumber($y)<9,
    "&value=" & URLEncode("0" & ToText(ToNumber($y)+1)),"&value=" & URLEncode(ToText(ToNumber($y)+1))));

By executing $URLONE or $URLTWO, they work fine.  Combining them so that they execute in order gives me the error - Uncaught ReferenceError: Invalid left-hand side in assignment

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

What am I doing wrong?

Thank you!
Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb

Posted 8 months ago

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

QuickBaseCoach App Dev./Training, Champion

  • 69,994 Points 50k badge 2x thumb
It will work if you change the javascript part to an API call.  The code you are using was auto generated by that wizard which makes the button but the identical functionality can be created using an API.


Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb
Thanks, Mark!  I rewrote URLONE as follows:

var text URLONE = "https://me.quickbase.com/db/masterdbid?act=API_CopyMasterDetail&destRID=0&sourcerid=1&copyfid=117";

but it isn't working.  I'll have to play with it more tomorrow.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,994 Points 50k badge 2x thumb
You are using record ID 1 as the source.

I think that you want

var text URLONE = "https://me.quickbase.com/db/masterdbid?act=API_CopyMasterDetail&destRID=0&sourcerid=& [Record ID#] & "&copyfid=117";
Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb
That makes sense but now I'm getting "CopyMasterDetail does not allow looping relationships".  I got this once before and I don't remember what was done to fix it, but it was a bear.  I might have to open another Support Case.  Thank you for your help!
Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb
Okay, I found the "looping" culprit and fixed that.  My Formula URL field is working fine except for one thing.  $URLONE copies the current record to a new record and puts "Copy of" into a field.  Then, I want to change that field in the new record using another API_EditRecord, but when I use "&rid=" & [Record ID#], it edits the original record, not the new "Copy".  How can I reference that new record's ID# in the API call?  Thank you!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,994 Points 50k badge 2x thumb
You can't as the [Record ID#] does not exist until after the URLONE is run.  What I have done is to land the user on a report of records created by the current user today with a name beginning with "Copy Of". 

There will likely just be one record, so then the user will edit that record manually, or if there is some known calculable value to go into that field, you could have a URL formula button on that record to go into the field.

One advantage of the javascript method is that it does nicely offer to land the user on the record.
Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb
Thank you, Mark.  I think I'm stuck again but I'll keep at it.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,994 Points 50k badge 2x thumb
Do you have duty rates by country?   Do you get what i mean by the concatenated field?  and see my post above with using a form rule to enter the formula value into a field that will be the Key field to the HTS table.
Photo of Ken Casser

Ken Casser

  • 702 Points 500 badge 2x thumb
I think this post was meant for some other thread
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,994 Points 50k badge 2x thumb
Yes, you are correct .  "duty" guy is probably waiting for an answer!