cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
 

INTRODUCTION:

This plugin explains how to limit filter members selection based on a predefined dimension.

PURPOSE/BENEFITS:

This plugin sets a maximum number of filter members allowed to be picked.
This will make the query lighter and will reduce server load.
In addition, when using other filter methods such as text filter, it already limits the result in the preview window.
 
The "OK" button in the filter member selector popup will be disabled until "include all" or N members or less are selected (N - defined in the dashboard script config)
 
Users with "viewer" role will not be able to expand filters (the expand button will be hidden)
Also, a message will be shown once the user passed the members limitation.
 

STEPS FOR IMPLEMENTATION:

Step 1:
Download the attached .zip file.
Extract the .zip file into the following path: "[Sisense installation path]\PrismWeb\Plugins". If the plugins folder does not exist, please create it.
Step 2:
On your dashboard, click the Menu button and select Edit Script.
Next, put the following snippet inside the dashboard’s script window as followed and click ‘Save’ :
An explanation for configuration properties and an example are under ‘Configuration’ section.

Once saved, refresh the dashboard in order for the script (config) to take effect.
Now, Viewers (only) should not see the filter expand button so they can’t hack the plugin and select more than the limit.
 
Viewer view:

Designer/Admin view:

When open the member selector using the ‘pencil’ icon, and select more than the limit defined in the config (dashboard’s script), a red message appears and OK button is disabled:
Once reducing the members selection, the message will disappear and the OK button will be available again.
 
When choosing text filter, the preview result will show only up to the limitation defined in the config + a red message indicates that these are partial result.
Once applied, the members will be limited in the widgets’ queries as well.

In the above example, there are more than just 5 items matches to the ‘Ar’ string but the plugin limits it.
 

CONFIGURATION:

You can use the following example as a start of your configuration:
prism.filterMembersLimitationConfig = [
               {
                   maxMembers: 5,
                   excludeMaxMembers: 5,
                   dimensionsToApply:["[Commerce.Age Range]", "[Country.Country]"]
               },
              {
                   maxMembers: 10,
                   excludeMaxMembers: 3,
                   dimensionsToApply:["[Brand.Brand]"]
              }
];
  
The above example shows a configuration for 3 different dimensions while 2 of them are limited to 5 members both for include and exclude and the other dimension is limited to up to 10 included members and 3 excluded members.
 
In red, the parts which should always remain.
In black, changeable parts.
 

LEGEND:

maxMembers - a property to indicate how many members are allowed to be picked.
excludeMaxMembers - a property to indicate how many members are allowed to be picked.
dimensionsToApply - an array of dimensions to be affected by the limitation. Each dimension is constructed as follows: “[table name.column name]”
 
If you have more than 1 limitation, as above, you should separate each limitation into wrapping curly parentheses with comma separated.

NOTES:

  • Support List and Text selection mode only
  • "Widget affects dashboard filters" should be turned off.
  • Filters should always be published in the collapsed state (even if the filter is not defined in the dashboard script config).
  • Limitation is applied to all users including the owner while hiding the filter expand button is applied only to viewers.
Version history
Last update:
‎03-02-2023 09:48 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

Sisense Privacy Policy