Forum Discussion

JonFroderberg's avatar
JonFroderberg
Qrew Cadet
6 years ago

Reports With API Filters Launched From URL Link Lose Filter Criteria

We have several report buttons on dashboards and forms in our apps that are coded to call the report and also apply various filters in the URL.  However, if the resulting report data set has more than one page of results, when a user clicks to see the next page of records, the report filters are lost when the screen refreshes.

URL to load the report:
https://hardermech.quickbase.com/db/bjjkii2fm?a=q&qid=227&query={9.EX.299008}AND{179.XEX.1}AND{281.LT.100}
Table Name: Milestone Data
Report 227
fid 9: [Job]
fid 179: [Delete This Milestone]
fid 281: [Scope % Comp]

When I run this report the result is three pages of records.
After I click on the link for the second page of records, the URL changes to this:
https://hardermech.quickbase.com/db/bjjkii2fm?a=q&qid=227&qskip=50&qrppg=50
And now the report is showing all the unfiltered records (460 pages).

One of the other developers, Jim, had a thought that maybe we could store and reference the filter criteria for the report in a javascript service worker, such that those values are stored in a stable location.
Any insight on how to overcome this report behavior would be greatly appreciated!

------------------------------
Jon Froderberg
PRIME Developer
Harder Mechanical Contractors
https://www.harder.com
Portland, OR
503.382.4413
------------------------------
#APIsandcustomcode
#queryparameters
#customreportbuttons
​
  • I work on Jon's team, and we wanted to share the resolution we found.

    When one clicks to view the next Result Page on a multi-page query return, the parameters "qskip" and "qrppg" are appended to the end of the URL. This process overwrites any manual query parameters. This also occurs when sorting by a column header. We found that these parameters can be manually added into the URL for the report button.

    For example:
      Before:
        https://YOURREALM.quickbase.com/db/YOURDBID?a=q&qid=113&query={29.EX.266501}AND{10.XEX.%27VOID%27}
      After:
        https://YOURREALM.quickbase.com/db/YOURDBID?a=q&qid=113&query={29.EX.266501}AND{10.XEX.%27VOID%27}&qskip=100&qrppg=100
        https://YOURREALM.quickbase.com/db/YOURDBID?a=q&qid=113&query={29.EX.266501}AND{10.XEX.%27VOID%27}&qskip=100&qrppg=100&dlta=sd7~

    We plan to add the qskip and qrppg parameters to our buttons with return parameters that meet the needs of our users. One can further customize URL based queries with the following parameters:
    Query (q=)
    • qskip (query skip)
      • The smallest record index the page displays
      • In our example, qskip=100 displays records starting on record index 101 out of 129
    • qrppg (query records per page)
      • How many records are displayed on the page
      • In our example, qrppg=100 displays 100 records at a time.
    Sorting (dlta=)
    • sd (sort down)
      • The Field ID that is sorted (high to low)
      • In our example, sd7~ sorts Field ID 7 high to low
    • su (sort up)
      • The Field ID that is sorted (low to high)
      • In our example, sd7~ sorts Field ID 7 low to high
    • ~
      • Allows sorting by multiple fields
      • For example, sd7~su8~ would sort by Field ID 7 high to low then by Field ID 8 low to high



    ------------------------------
    Evan Westbrook
    ------------------------------