We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Locked/Invisible Filters

Resolved
Daniele asked on June 9, 2021

Is it possible to set filters to the report that are not visible by the user?
I use data source type = api connecting to SQL Server.
Thanks,
Daniele

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 9, 2021

Hello, Daniele,
 
Thank you for contacting us.
 
You can configure the desired filtering and hide the corresponding UI control by setting the filters property of the Mapping Object to false. Here is a JSFiddle we prepared for your reference: https://jsfiddle.net/flexmonster/squh13ep/.
It demonstrates the filtered "Category" field with "Bikes" and "Card" members being excluded:

{
"uniqueName": "Category",
"filter": {
"exclude": [
"category.[bikes]",
"category.[cars]"
]
}
}

In its turn, the UI control responsible for manual filtering is disabled in the mapping object:

mapping: {
Category: {
filters: false
}
}

You can even disable filtering for all the fields at once using the grid.showFilter property of the Options Object.
 
Please let us know if it works for you.
Looking forward to your feedback.
 
Regards,
Illia

Public
Daniele June 10, 2021

Hi Illia,
thank you very much, but i need something different. I try to explain better.
I would like that different users see different subset of data from the same data source index, without see the filter. I can build different reports, but I would like to use the same index because users can be a lot.
Example: User A sees all categories sold in Australia and he can customize all other filters but Country. User C sees all categories sold in Canada and he can customize all other filters but Country. User S is a supervisor and he can see all countries and can filter them.
Thanks,
Daniele

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 10, 2021

Hello, Daniele,
 
Thank you for the clarification.
 
If we understand correctly, your requirement is to have a hidden field ("Country" in your example) that would be used only for filtering. This field should not be visible or editable by non-supervisors.
 
It can be achieved using two different approaches.
 
The first one is easier to implement, however, it implies filtering on the client side. It means all the data will be loaded to the client's browser and filtered afterward. This approach may not be suitable if the data is sensitive or should be strictly secured between different users' roles.
Here is a JSFiddle we prepared for the demonstration: https://jsfiddle.net/flexmonster/my5fL8a2/. The "Country" field is placed in the report filters. The filter is adjusted to display only the records associated with an "Australia" member. The filters property is set to false similar to the approach mentioned earlier. It will disable manual filtering for the final user.
Finally, the "Country" field is removed from the Field List every time the fieldslistopen event is triggered. It allows making sure the user cannot remove the filter from the slice.
 
The second approach implies using Flexmonster Data Server as a DLL. The DLL can be extended to implement the desired filtering based on some token received from the client. Here is the documentation dedicated to implementing the server filter using the Data Server as a DLL. This approach is more secure because filtered data will not be coming to the client's browser.
 
Please let us know if it helps.
 
Best regards,
Illia

Please login or Register to Submit Answer