Forum Discussion

KenCasser's avatar
KenCasser
Qrew Cadet
6 years ago

Calling two variables in a Formula URL Field

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!

10 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.


  • 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!
  • 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.
  • 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.
    • KenCasser's avatar
      KenCasser
      Qrew Cadet
      I think this post was meant for some other thread
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Yes, you are correct .  "duty" guy is probably waiting for an answer!