Question about report filtering and display of unwanted data

Answered
Willians Cirilo asked on June 10, 2023

Hello,
I have a question regarding a report that has a filter. However, when the data does not contain the specific value to be filtered, the filter is ignored and the report shows me the data that I actually requested not to appear.
I have created a demonstration where I reload the data using two buttons. The "setData1" button works correctly because the filter has the value "red" and displays the data correctly. However, the "setData2" button does not work properly as the data does not have the value "red" and ends up showing the "blue" and "green" data that I filtered out.

Demonstration: https://jsfiddle.net/u206ehak/2/
I would like to know if I am making any mistakes in configuring the filter.
Thank you in advance for your response!
Best regards, Willians Cirilo

9 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 12, 2023

Hello, Willians!
 
Thank you for contacting us.
 
Kindly note that when there is no specific data for the filter, the filter is considered invalid in Flexmonster, and all the data is shown.
If you want to show an empty grid instead, please look through our guide on this case: https://www.flexmonster.com/doc/advanced-tips-filtering/#show-empty-grid-when-filtering-by-non-existent-members.
 
Hope you will find our answer helpful.
 
Kind regards,
Solomiia

Public
Willians Cirilo June 12, 2023

Hello Solomiia,
I hope you're doing well. I wanted to discuss some doubts related to the functioning of filters in Flexmonster.

  1.  Saving the report edited by the user: When using the "getReport()" function to save the report edited by the user, I would like to confirm if this configuration is done only through coding or if it can also be done directly through Flexmonster.
  2.  Invalid filter and alert: I noticed that when a filter is considered invalid, the entire result of the report is altered, showing data that should not be presented. I would like to understand why an alert is not displayed informing that the filter is invalid.

I appreciate your response and guidance in advance.
Best regards,
Willians Cirilo

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 13, 2023

Hello, Willians!
 
Thank you for getting back to us.
 
Please find answers to your questions below:
 
1. The report can be saved and restored using getReport() API call, as well as the Save button on the Toolbar.
You can find more details about saving and restoring reports on the following page: https://www.flexmonster.com/doc/save-and-restore-report/.
 
2. Regarding the invalid filter alert, please note that if no members in the filter match the data, then the filter is just not applied. This is the expected filtering behavior, and we're not considering it an error.
 
If you would like to show a pop-up message when the filter didn't get applied, we suggest checking if the filter is present in the report and displaying the alert if needed.
We have prepared a JSFiddle sample to illustrate the idea: https://jsfiddle.net/flexmonster/pv6kgwm5/.
 
Could you please let us know if the suggested approach works for your case?
Looking forward to hearing from you.
 
Kind regards,
Solomiia

Public
Willians Cirilo June 14, 2023

Hello Solomiia,
I apologize for my previous expression:
Regarding the first question, my doubt is about the usage described in https://www.flexmonster.com/doc/advanced-tips-filtering/#show-empty-grid-when-filtering-by-non-existent-members. It mentions the use of the include property and query: { equal: "" }, but by default, Flexmonster uses the members property.
As for the second question, I appreciate the suggestion of displaying an alert message. However, as I mentioned before, the report is dynamically generated by the end user. Therefore, I need a generic alert as I don't know which filter the user will use to indicate the field.
Once again, thank you for your help and response.
Best regards, Willians Cirilo

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 15, 2023

Hello, Willians!
 
Thank you for the details about your use case.
 
Kindly note that when filtering members from the UI, only members present in the dataset are listed in the Filters pop-up. Therefore the clients have no chance to filter by non-existent members.
Could you please let us know if you are using any other filtering methods aside from our default UI pop-up? This would help us greatly to continue the investigation.
 
Looking forward to hearing from you.
 
Kind regards,
Solomiia

Public
Willians Cirilo June 15, 2023

Hello Solomiia,
I hope you're doing well.
In fact, we only use the default filter from the UI pop-up. This filter meets the needs of most use cases and provides a simplified experience for our users.
If you have any suggestions you would like to share with us, please don't hesitate to let us know. We are always looking for ways to improve and meet the needs of our users.
Thank you for your attention and collaboration.
Best regards, Willians Cirilo

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 19, 2023

Hello, Willians!
 
Thank you for the details about your use case.
 
As we understand, the described behavior with no data for the filter appears when changing the data using setReport() API call with your custom controls.
We had prepared a JSFiddle example with a generic alert message, so the users would know that their previous filter was cleared when the data was changed: https://jsfiddle.net/flexmonster/oqg56b4k/.
 
In this example, the getAllHierarchies() API call was used to retrieve all fields. Then, we get all existing filters iterating on fields with the getFilter() API call. After the data is changed and a new report is loaded, we compare the filters and show the alert pop-up if any of them is missing.
 
Hope it helps.
Please let us know if the suggested approach satisfies your needs.
 
Kind regards,
Solomiia

Public
Willians Cirilo June 21, 2023

Hello Solomiia,
I hope you're doing well.
Your example meets our needs. Thank you very much for your attention and collaboration.
Best regards, Willians Cirilo

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 21, 2023

Hello, Willians!

Thank you for your feedback.

We are glad to hear the suggested approach works for you.

Feel free to contact us in case of any other questions.

Kind regards,
Solomiia

Please login or Register to Submit Answer