Forum Discussion

GunshamLakhiani's avatar
GunshamLakhiani
Qrew Cadet
6 years ago

Report report with dynamic filter applied?

HI,
Is it possible to load a report with dynamic filter applied ? 
I tried saving the bookmark of a report with applied filter but that didn't work

https://kbi.quickbase.com/db/bpydq29yx?a=q&qid=19#dynamic/{"sidebar":[{"facetid":16,"data":{"value":"B/L%20Awaiting"}},{"facetid":16,"data":{"value":"B/L%20Sent"}},{"facetid":16,"data":{"value":"Payment%20Received"}}],"searchString":"","ver":1}

------------------------------
Gunsham Lakhiani
------------------------------
  • I used a button yesterday and got a little help from someone on this. Note the URLEncode field as the value and also replace the %20 with \"


    URLRoot() & "db/bpnnzrjnw?a=q&qid=8#dynamic/{\"sidebar\":[{\"facetid\":12,\"data\":{\"value\":\""&URLEncode([Project Name])&"\"}}],\"searchString\":\"\",\"ver\":1}"

    ------------------------------
    Jason Johnson
    ------------------------------
    • TomMusto's avatar
      TomMusto
      Qrew Cadet
      %20 is actually a URL encoded space ( ), so I believe all of the %20 should be replaced with a space. %22 is a URL encoded quote ("), and those are the ones that should be replaced with \". I think the following formula should work:
      URLRoot() & "db/" & Dbid() & "?a=q&qid=19#dynamic/{\"sidebar\":[{\"facetid\":16,\"data\":{\"value\":\"B/L Awaiting\"}},{\"facetid\":16,\"data\":{\"value\":\"B/L Sent\"}},{\"facetid\":16,\"data\":{\"value\":\"Payment Received\"}}],\"searchString\":\"\",\"ver\":1}"

      ------------------------------
      -Tom
      ------------------------------
  • For others reading this that aren't familiar with how you derived the string, open a report, apply the dynamic filters you want to use, then copy the URL from your browser then make the following modifications to the string:

    Example copy & paste from browser:
    https://XXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=q&qid=6#dynamic/{%22sidebar%22:[{%22facetid%22:7,%22data%22:{%22value%22:%22Activity%201%22}},{%22facetid%22:10,%22data%22:{%22value%22:%22Yes%22}},{%22facetid%22:15,%22data%22:{%22value%22:%222018%22}}],%22searchString%22:%22%22,%22ver%22:1}


    Search and replace %22 with \" and wrap the whole string in quotes

    "https://XXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=q&qid=6#dynamic/{\"sidebar\":[{\"facetid\":7,\"data\":{\"value\":\"Activity%201\"}},{\"facetid\":10,\"data\":{\"value\":\"Yes\"}},{\"facetid\":15,\"data\":{\"value\":\"2018\"}}],\"searchString\":\"\",\"ver\":1}"

    There is no need to change the characters for the dynamic values. Copy & paste the modified string into a formula URL field and add that field to a report or form and it will open the report with the dynamic filters applied.

    Tom's code should work, but you don't have to replace the %20. For that matter your original code should work if you just wrap it in quotes and add the backslashes

    "https://kbi.quickbase.com/db/bpydq29yx?a=q&qid=19#dynamic/{\"sidebar\":[{\"facetid\":16,\"data\":{\"value\":\"B/L%20Awaiting\"}},{\"facetid\":16,\"data\":{\"value\":\"B/L%20Sent\"}},{\"facetid\":16,\"data\":{\"value\":\"Payment%20Received\"}}],\"searchString\":\"\",\"ver\":1}"​

    This version of my example works
    "https://XXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=q&qid=6#dynamic/{\"sidebar\":[{\"facetid\":7,\"data\":{\"value\":\"Activity%201\"}},{\"facetid\":10,\"data\":{\"value\":\"Yes\"}},{\"facetid\":15,\"data\":{\"value\":\"2018\"}}],\"searchString\":\"\",\"ver\":1}"​


    ------------------------------

    Adam Keever
    ------------------------------
    • GunshamLakhiani's avatar
      GunshamLakhiani
      Qrew Cadet
      I apologize in advance for more questions.  I'm still unable to get this working. 

      My reports opens without the filter 
      • As Jason suggested , I've tried replacing %20 with \" ,
      •  As Tom suggested , I made a formula which %22 with \"
      •  As Adam in detail suggested , I copy pasted form browser and replaced %22 with \" and wrapped in a quote 


      ------------------------------
      Gunsham Lakhiani
      ------------------------------
      • JasonJohnson2's avatar
        JasonJohnson2
        Qrew Cadet
        Below is my rich text formula button that opens in a new tab. I did notice that if the report did not have records when I dynamically  filtered that it looked like no filters applied. I ended up using the table to table to create a summary of all records in that status and only if there were records in that status did the button show. No harm in hiding the button if nothing is there to show. I know you can do the same with a URL Formula field as well but I almost never use those.


        // Original URL https://MYQUICKBASEURL/db/bpnnzrjnw?a=q&qid=8#dynamic/{%22sidebar%22:[{%22facetid%22:12,%22data%22:{%22value%22:%22WHERE I INSERTED MY SEARCH PARAMETERS%22}}],%22searchString%22:%22%22,%22ver%22:1}
        // Begin button style
        var text bgcolor = "#006666";
        var text bgcolorm = "#00b3b3";
        var text txtcolor = "white";
        var text style = "style=\"text-decoration: none; box-shadow: 3px 3px 1px #888888; background:" & $bgcolor & "; color: " & $txtcolor & "; border-radius: 3px; padding: 5px 8px; display: inline-block; font-weight: normal;font: 700 24px/1 \"Calibri\", sans-serif; \" onMouseOver=\"this.style.backgroundColor='" & $bgcolorm & "'\";\" onMouseOut=\"this.style.backgroundColor='" & $bgcolor & "'\"; text-align: center; text-shadow:none;";
        // End button style


        var text URL= URLRoot() & "db/bpnnzrjnw?a=q&qid=8#dynamic/{\"sidebar\":[{\"facetid\":12,\"data\":{\"value\":\""&URLEncode([Project Name])&"\"}}],\"searchString\":\"\",\"ver\":1}";

        If([# Approved Costs]>0,

        "<a " & $style & " target='_blank' href=" & $URL

        & "> Approved Costs </a>","")

        ------------------------------
        Jason Johnson
        ------------------------------