Hi team, I have found issue in showing data with report filters.
I have report filter already added for terminal field with data "EMG1". I am not adding filter at runtime, my filter is already saved.
Scenario 1- If my data set contains record with terminal = EMG1 then it shows correct data for that terminal only.
Scenario 2- If my data set does not contain record with terminal = EMG1 then it shows all records i.e. it shows records for other terminals also.
I am using trial version of 2.9.88
Hello, Amar!
Thank you for writing to us.
Please note that this is a default filter behavior. When the member defined in the filter cannot be found in the dataset, such a filter is considered invalid and not applied. This can be changed by setting the filter.allowEmptyMembersFilter
option. With this option, an empty grid is shown when the value used in the filter is not present in your data.
Please let us know if this solution works for you.
Best Regards,
Maksym
Hi Maksym,
Thanks for quick response. Mentioned solutions is not working. I will explain my scenario in brief again. I am showing data in compact form layout as pivot aggregated data.
Below are my predefined report filters -
"reportFilters" : [
{
"uniqueName" : "dataName",
"filter" : {"members" : ["dataName.[MN]"]}
},
{
"uniqueName" : "terminal",
"filter" : {"members" : ["terminal.[EMGS33]"]}
}
]
If my data set does not contain data with terminal EMGS33 then it shows all data.
As you mentioned in solution it should show blank grid incase member filter is invalid, but this is not happening.
below is my report option-
report.options = {
configuratorButton: true,
drillThrough: false,
grid: {
showHierarchyCaptions: false,
showHeaders: false,
showGrandTotals: 'off',
},
filter: {
allowEmptyMembersFilter: true
},
showAggregationLabels: false,
};
report.localization = {
grid: {
type: 'compact',
blankMember: '',
dateInvalidCaption: '',
},
};
Hello, Amar!
Thank you for your detailed explanation.
We apologize for missing a crucial point in our previous reply - the filter.allowEmptyMembersFilter
option works only for CSV and JSON data sources. If you are using a different data source, this explains why it did not work for your case.
For other data sources, there is a more universally applicable solution that ensures an empty grid is displayed when filtering by non-existent members. This solution is described in our documentation: Show an empty grid when filtering by non-existent members.
In addition to the approach described in the article above, you can simply set the query filter equal to a non-existing member, which covers the cases when you filter by only one member: https://jsfiddle.net/flexmonster/yzra0gkd/
Please let us know if our recommendation helped you.
Best Regards,
Maksym
Hi Maksym,
Mentioned solution has resolved my issue.
Thank you.
Hello, Amar!
Thank you for your reply.
We are glad to hear that the provided solution worked for you.
Do not hesitate to contact us if more questions arise.
Best Regards,
Maksym