Discussions

 View Only
Expand all | Collapse all

Calling two variables in a Formula URL Field

  • 1.  Calling two variables in a Formula URL Field

    Posted 10-24-2018 17:40
    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!


  • 2.  RE: Calling two variables in a Formula URL Field

    Posted 10-24-2018 19:10
    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.




  • 3.  RE: Calling two variables in a Formula URL Field

    Posted 10-24-2018 20:58
    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.


  • 4.  RE: Calling two variables in a Formula URL Field

    Posted 10-24-2018 23:45
    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";


  • 5.  RE: Calling two variables in a Formula URL Field

    Posted 10-25-2018 15:30
    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!


  • 6.  RE: Calling two variables in a Formula URL Field

    Posted 10-29-2018 20:00
    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!


  • 7.  RE: Calling two variables in a Formula URL Field

    Posted 10-29-2018 20:59
    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.


  • 8.  RE: Calling two variables in a Formula URL Field

    Posted 10-29-2018 21:02
    Thank you, Mark.  I think I'm stuck again but I'll keep at it.


  • 9.  RE: Calling two variables in a Formula URL Field

    Posted 10-29-2018 21:04
    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.


  • 10.  RE: Calling two variables in a Formula URL Field

    Posted 10-30-2018 15:54
    I think this post was meant for some other thread


  • 11.  RE: Calling two variables in a Formula URL Field

    Posted 10-30-2018 16:14
    Yes, you are correct .  "duty" guy is probably waiting for an answer!