Skip to main content
Question

Calling two variables in a Formula URL Field

  • October 24, 2018
  • 0 replies
  • 90 views

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!
This topic has been closed for replies.

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.



  • Author
  • Registered
  • October 25, 2018
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.

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";

  • Author
  • Registered
  • October 25, 2018
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!

  • Author
  • Registered
  • October 30, 2018
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!

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.

  • Author
  • Registered
  • October 30, 2018
Thank you, Mark.  I think I'm stuck again but I'll keep at it.

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.