Forum Discussion

JoeMarchillo's avatar
JoeMarchillo
Qrew Trainee
4 years ago

QID in Query String

I'm looking for a way to dynamically capture a qid from the query string in a formula field. I have a button that's on many different reports that checks a box, and runs an automation that copies some fields. I have about 50 reports that are basically identical, but filtered out by various programs and clients. Right now my formula field has an &rdr= that just takes them to the form view of the record they just changed. What I want to do is take them back to the exact report they were looking at. So to get the qid in javascript I would use the URL object and do something like params.get but I can't figure out a way to get the value into my formula field so I can use it as a redirect. Any thoughts?

------------------------------
Joe Marchillo
------------------------------

4 Replies

  • Can you post your current URL formula ?

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • JoeMarchillo's avatar
      JoeMarchillo
      Qrew Trainee
      var text buttonText = "Get QID";
      //if I do this as an alert, the proper qid comes up
      var text myQid = "javascript:{ let params = (new URL(document.location)).searchParams; let qid = params.get('qid'); return qid;}";

      // set the checkbox and return to the report
      var text urlOne = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_9=1" & "&apptoken=myapptoken";
      var text urlTwo = URLRoot() &"db/" & Dbid() &"?a=q&qid=" & $myQid;
      var text href = $urlOne & "&rdr=" & URLEncode($urlTwo);
      //I also tried to use the z=rurl() method and was unsuccessful

      "<div><a href='" & $href & "' class='btn btn-warning' style='font-weight:bold;text-decoration:none;color:white;'>\n&nbsp;&nbsp;"
      & $buttonText
      & "&nbsp;&nbsp;\n</a>\n</div>"

      ------------------------------
      Joe Marchillo
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        If you just want to check a checkbox and refresh the page (ie any record or report that you are on) you can use this syntax as a URL formula

        var text URL  = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_9=1" & "&apptoken=myapptoken";


        "javascript:" &
        "$.get('" &
        $URL &
        "',function(){" &
        "location.reload(true);" &
        "});"
        & "void(0);"

        If you want it to be a Rich Text field you could adjust the Syntax for that.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------