🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

How to apply a global filter before fetching data for report

Answered
Ashwani asked on December 1, 2020

I would like to load initial data for a report based on some pre-defined filters. I can do drill-down after loading the whole data in report but is there any way using which we can pass some pre-filters to flexmonster custom data server to fetch a specific set of data.
 
 

Attachments:
pre-filter-report.png

1 answer

Public
Vera Didenko Vera Didenko Flexmonster December 1, 2020

Hello, Ashwani,
 
Thank you for reaching out to us. 
 
To start, we would like to kindly explain that when the custom data source API is used, only the data that is needed for the current display is sent to Flexmonster.
This means you can preconfigure the report on Flexmonster’s end to display a specific set of data on initial load.
For example, you could specify the fields you would like to be shown and set filters for the fields in the report object’s slice property.
We have prepared a JSFiddle example illustrating this approach: https://jsfiddle.net/flexmonster/focv105k/.
Such a solution would require minimal development from your end.
 
With the above approach, the report will be prefiltered, but all the members will still be loaded to provide the possibility to apply a different filter later. 
In case you would like to prefilter the members list as well, we would recommend proceeding with a server-side filter implementation. 
The customizeAPIRequest method could be used to edit the request before it is sent to the server and add additional headers. Based on the received data on your custom data source API endpoint, you could prefilter the result that will be sent to Flexmonster.
 
Please let us know if this helps. 
Looking forward to your response.
 
Kind regards,
Vera

Please login or Register to Submit Answer