Get Free Trial

How to filter on fields that are marked as hidden

Rainer Wittmann asked on May 14, 2020

When a field is mapped to string it’s possible to filter on that field.
In our scenario, ProjectIds are dynamically set via slice.reportFilters and ProjectIds should be not available to the end-user. 
That seems to be an ideal candidate for a type: “hidden” field, however, after switching the mapped field type to “hidden” the control doesn’t filter any longer.
Is that the expected behavior or is that a bug? If expected please advise another option to address the scenario. Please note that in the real world we’re using the custom data API server as the data source, so a proposed solution must work there as well.
Thanks for any pointers in the right direction,

2 answers

Mykhailo Halaida Mykhailo Halaida Flexmonster May 15, 2020

Hi Rainer,
Thank you for posting your question.
This is indeed the expected behavior, as the hidden field type basically excludes the field from the data altogether, which makes it impossible to filter the hidden field.
In cases like this, we usually suggest implementing such filters on the server-side instead. With that in mind, we would recommend using the cusomizeAPIRequest() API call, which allows you to customize the requests sent to the server for the custom data source API. More specifically, it can be used to set custom request headers containing information about the current user/session, which can then be used on the server to filter the data depending on the user. 
This approach makes it possible to carry out the filtering on the server-side, after which the filtered data can be returned to the pivot table without the need to display any filters to the user.
Please let us know if this helps.
Best regards,

Rainer Wittmann May 17, 2020

Thanks, Mykhailo,
Using customizeAPIRequest() to send the required information seems like a viable solution.

Please login or Register to Submit Answer