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
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
Hello Solomiia,
I hope you're doing well. I wanted to discuss some doubts related to the functioning of filters in Flexmonster.
I appreciate your response and guidance in advance.
Best regards,
Willians Cirilo
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
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
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
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
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
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
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
Hello, Willians!
Hope this letter finds you well.
The Flexmonster team is happy to let you know that we’ve recently added a new functionality to our pivot grid, which we believe you might find valuable.
For the JSON and CSV data sources, we have added a new filter.allowEmptyMembersFilter option starting from the 2.9.86 version of Flexmonster. This property allows to show an empty table when the selection filter includes only members that do not exist in the dataset instead of removing the invalid filter.
So, if this approach matches your data source type(JSON or CSV), you are welcome to use it instead of the workaround we provided earlier. For other data source types, we recommend sticking to the approach of combining member and query filters.
Here is the JSFiddle to illustrate the idea: https://jsfiddle.net/flexmonster/vkthmug4/.
You can find more details about the new filtering functionality in our docs: https://www.flexmonster.com/doc/advanced-tips-filtering/#show-empty-grid-when-filtering-by-non-existent-members.
Feel free to explore the new property, and if you have any questions or feedback, we’d be happy to assist.
Kind regards,
Solomiia
Hello, Solomiia,
Thank you for reaching out and for introducing the new functionality in Flexmonster. I'm happy to see continuous improvements in the tool.
I’ve had a chance to explore the new filter.allowEmptyMembersFilter option, and it fits perfectly with my current use case, as I primarily work with CSV data sources. This addition is very welcome and simplifies the implementation significantly compared to the workaround we used previously.
However, I noticed one point that might need further consideration. When applying a filter with filter.allowEmptyMembersFilter enabled, the filter UI does not display the members that are present in the members array. This could potentially lead to some confusion, as the filter doesn’t visually reflect the selected members. It would be helpful if the filter UI could somehow indicate the members being filtered, even if they don't exist in the dataset.
Please let me know if there is any additional configuration to address this, or if it’s something planned for future releases. Once again, I appreciate the update and the opportunity to provide feedback.
Kind regards,
Willians
Hello, Willians!
Thank you for getting back to us.
We are happy to hear our new property works well for you.
Regarding your request, we have added a feature of showing the filtered members in the field pop-up even if they are not present in the data to our Customers' Wishlist. Our team will notify you if there are any updates on the matter.
Feel free to reach out to us if any other questions arise.
Kind regards,
Solomiia
Hello Solomiia,
Thank you for your ongoing support with this case and for introducing the new filter.allowEmptyMembersFilter functionality. It's truly a valuable addition that significantly simplifies handling filters with non-existent members.
However, I'd like to report an unusual behavior I observed during testing with this new option. When I configure a filter like:
filter: {
exclude: ["color.[red]", "color.[orange]"]
}
And these color members don't exist in the dataset, Flexmonster appears to automatically convert the filter to:
filter: {
members: ["color.[red]", "color.[orange]"]
}
This automatic alteration of the filter structure can be confusing, especially when working with dynamic data where datasets may vary.
I've created a demonstration that illustrates this behavior:
https://jsfiddle.net/bmy7wqj9/
When I use setData1 (which contains data matching the filter), the filter structure correctly remains as:
filter: {exclude: ["color.[red]","color.[orange]"]}
However, when I use setData2 (which does **not** contain the filter data), Flexmonster automatically changes it to:
filter: {members: ["color.[red]","color.[orange]"]}
My main question is: Is there any additional configuration to preserve the original filter structure (exclude) even when the filtered members don't exist in the dataset?
This preservation would be important to maintain consistency in saved reports and the filtering logic defined by the user, regardless of the data currently present.
Thank you for your attention, and I look forward to your response.
Best regards,
Willians Cirilo
Hello, Willians!
Thank you for sharing this use case with us.
Our Dev team will take a look at the described behavior when exclude filter gets converted to members filter with allowEmptyMembersFilter: true.
We will get back to you within the ETA November 10th.
Feel free to contact us if any other questions arise.
Kind regards,
Solomiia
Hello, Solomiia!
Thank you very much for your message and for keeping me informed about the next steps.
I will be awaiting your return by November 10th, as informed.
Have a great day!
Best regards,
Willians Cirilo
Hello, Willians!
Thank you for your swift response.
Our team will get back to you with updates on the discussed case within the given ETA.
Do not hesitate to ask if you have any other questions.
Kind regards,
Solomiia
Hello Solomiia,
To assist the Dev team's analysis, I would like to complement that the same behavior also occurs in pivot.getReport().slice.reportFilters, and I've noticed inconsistencies when multiple 'exclude' filters are applied simultaneously - the conversion to 'members' doesn't happen consistently in all cases. It's worth mentioning that these inconsistencies manifested in varied ways across different saved reports during our testing.
As I'm not deeply familiar with the tool's intricacies, I believe your team may better identify if there are other areas where filters could be affected - you're probably already considering this in your analysis.
These additional details might be helpful for a more comprehensive investigation.
I look forward to the November 10th ETA.
Best regards,
Willians Cirilo
Hello Willians,
Thank you for sharing the additional details!
Our team will consider this when implementing the fix and will notify you once the minor release, which includes it, is available.
You are welcome to contact us if other questions arise.
Kind regards,
Nadia