Get Free Trial

question about filter with a value not in the liste

long yu asked on April 16, 2021

hi :
I found if value in the filter don’t be in the data,
it will show all the data considered as without filter.
for example, in the data, i have 5 lines with month ‘january’, ‘february’, ‘april’, ‘june’, ‘september’,
if in the filter, it’s month.[may], it show all 5 lines.
but, in theory, it must show zero line.
could you help me plz ?
thanks a lot.

4 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 19, 2021

Thank you for reaching out to us.
We want to confirm that Flexmonster will remove filters with non-existent members. It is a limitation of the internal architecture.
Still, there is a workaround we recommend for this case. Instead of filtering by members, try filtering using a query. Please see the documentation dedicated to Filter Object for detailed information. In your case, the String Query Object with “equal” or “contain” condition. In this case, an empty table will be displayed in case none of the members equals or contains the specified string.
Our team hopes it works for you.
Feel free to reach out in case further questions arise.

long yu April 20, 2021

hi Illia Yatsyshyn
thanks for your response,
but it couldn’t resole my problem.
it’s the same report for data of different period and it’s user who create it himself.
so  could you give me an other solution 
or could you add a option to do not remove filters with non-existent members plz ?
thanks a lot

Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 21, 2021

Thank you for your feedback.
We want to explain that the current implementation would not allow member filtering by absent members. This feature is unlikely to be added in the nearest future because it leads to major internal conflicts.
We suggest checking out another workaround. It implies validating filters before applying them to the report.
The idea lies in the following:
It is possible to get the list of all members in a hierarchy with the getMembers() API call.
With this in mind, it is possible to check if at least one of the passed values exists in the searched field. If at least one value exists, proceed with a members filter. In case no values are found in the members’ list, proceed with an “equal” query filter and pass any value from the search query to it (for example, the first value).
We have prepared a simple JSFiddle example demonstrating the described approach:
In your case, the scenario would look similar to the following:

  1. Get the desired report as a JSON object.
  2. Retrieve filtering by members and save it for later use.
  3. Apply report to the component.
  4. Check the saved filters by members as shown in the JSFiddle.
  5. Apply filtering using the setFilter API call.

We hope it helps.
Please contact us if other questions arise.
Kind regards,

long yu April 22, 2021

thanks a lot Illia Yatsyshyn.

Please login or Register to Submit Answer