Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

How to assign report filter before fetch data

Answered
Brad Huang asked on February 20, 2021

Because query data without filter might spends lots of times.
If user has already chosen fields for report filter.
Dose it possible to add a query button in filter area
with the query button, it will not query data unless user assign all conditions for filter that he wants.
After he assigned all conditions and pressed the query button, it will start the query.

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 22, 2021

Hello,
 
Thank you for reaching out to us.
 
Currently, built-in UI controls do not allow pre-filtering.
However, we have come up with a workaround that may work for you.
It implies developing a custom Field List that would allow the required functionality.
You will find the detailed explanation and the example below.
 
On the initial load, retrieve all the fields using the getAllHierarchies API call.
Having the enumeration of all fields, it is possible to compose and display the custom Field List.
After the user choose what field needs to be used for filtering, execute the getMembers method to receive the list of members for this field. Use this information to configure the corresponding filtering UI controls. Complement the filtering view with a label filter if needed.
 
To summarize, the process will look like this:

  1. Open an empty report without a slice specified.
  2. Execute the getAllHierarchies method and receive the list of all hierarchies.
  3. Display the custom Field List with all the received fields. Display filtering button for each field.
  4. After the user clicks on the filtering button, execute the getMembers method.
  5. Display the custom filtering window with all the received members of the chosen field.
  6. After the user applies filtering rules for chosen fields, compose the Slice Object and include appropriate Filter Objects.
  7. Apply the configured slice using the runQuery API call.

 
Also, we have prepared a JSFiddle to demonstrate this approach: http://jsfiddle.net/flexmonster/8hjrmu4g/.
 
Please note that this particular JSFiddle is developed for the SSAS data source. It may need to be customized based on your data source (for example, custom data source API).
 
Please let us know if it works for you.
Our team is looking forward to hearing from you.
 
Kind regards,
Illia

Public
Brad Huang February 23, 2021

Dear Illia
Thanks for your rapid response. Current structure is already pretty smooth. Can I use event: runningquery to stop the query manually while there is no filter selected. With that I can add a query button by myself.

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 23, 2021

Hello,
 
Thank you for your feedback.
 
It is not possible to abort the query and continue it later after complementing report filters.
It means you will need to select fields and configure filtering before running the query.
 
Therefore, we suggest developing a custom Field List that would expand the default functionality and allow the user to configure filtering before executing the query.
 
Feel free to reach out in case other questions on this point arise.
 
Kind regards,
Illia

Please login or Register to Submit Answer