getFilter issue for blank field and field with single value

Saiprasad Devare asked on April 10, 2019

Hi there,
I am using flexmonster’s slice.reportFilters to set a reportFilters
and then apply setFilter() api to set the filters. Afterwards I call getFilters() api, this gives me confirmation that filter is applied or not.
But when I applied the filter to a ‘field’ that has only one value then the getFilters() does not return the applied filter, it return ‘null’. I know that filter is applied but getFilter() does not return the applied filter.
Now, the problem is that
case 1> if I applied a filter to a ‘field’ which doesn’t exist(here, i am using csv data and csv doesn’t have that field) then getFilter() return ‘null’.
case 2> if I applied filter to a ‘field’ which has only one value, then getFilter() return ‘null’
 

How should I distinguish it from both of then?
 
 
For example
Consider this as csv data
id name address
1    a       xyz
2    b       xyz
3    c        xyz
4    d       xyz
for case 1
flexmonster.setFilter(“rollno”, “rollno.[rollno1]“);
flexmonster.getFilter() ==> #return null
for case 2
flexmonster.setFilter(“address”, “address.[addressxyz]]’);
flexmonster.getFilter() ==> #return null

Flexonster version => version: “2.6.3”

4 answers

Public
Dmytro Zvazhii Flexmonster April 10, 2019

Hello Saiprasad,
Thank you for writing to us.
We recommend using getAllHierarchies() API call to define whether such field is available in the structure. Please refer to our docs for more information of getAllHierarchies() API call: https://www.flexmonster.com/api/getallhierarchies/.
Let us know if the suggested approach solves the case.
Regards,
Dmytro
 

Public
Saiprasad Devare April 10, 2019

Hello Dmytro Zvazhii,
Thanks for quick reply. 
But, if you applied filter to a ‘Field’ which has more than one value, then getFilter() return the applied filter. 
For case 2 i.e if I applied filter to a ‘field’ which has only one value, then getFilter() return ‘null’
here for case 2 I was expecting that getFilter() will return the applied filter
 

Public
Dmytro Zvazhii Flexmonster April 11, 2019

Hello Saiprasad,
Thank you for your feedback. 
Currently, it is not available. As a workaround, you can use getMembers() API call to define how many members the field has. If it is only one member there is no need for setting a filter and then checking it. Please refer to our docs for more information about getMembers() API call: https://www.flexmonster.com/api/getmembers/.
Please let us know in case of any other question.
Regards,
Dmytro

Public
Saiprasad Devare April 12, 2019

Thankyou Dmytro. We have done the same

Please login or Register to Submit Answer