Auto Add Filter Based On User
Download: Auto FIlter
Introduction
This article explains how to automatically add a dashboard filter, based on the logged in user.
Purpose/Benefits
In order to provide a better user experience, you may want to automatically set a filter on your dashboards based on the logged in user. This plugin checks the dashboard as it loads and looks for any filters that match the Elasticube. If it finds any in the config file, it uses the user's email address to find a selection value and adds the filter automatically
Step 1 - Add The Plugin
Download the attachment and unzip the contents into your C:\Program Files\Sisense\PrismWeb\plugins\ folder. If you are using version 7.2 and higher unzip the contents into your C:\Program Files\Sisense\app\plugins\ folder. If the plugins folder doesn't exist, just create it. After those files have been unzipped there, you may also have to restart the web server.
Step 2 - Configure The Plugin
Open the config.js file to manage the auto filters. There is a config variable, which contains a list of the filters to add. Each filter should include the following properties
- server - the server of the Elasticube (in case of remote Elasticube servers)
- elasticube - the name of the Elasticube this filter applies to
- filter - the filter that will be added to the dashboard, this object has dimension ([Table.Column]), datatype, and title as properties
- queryMatch - the field that will match the logged in user's email, you need to specify the dimension and datatype
- querySelection - the field to query for, the values we get back will be added to the dashboard filter
- type - can be "first" or "all", determines what to do with multiple results from the query (use only the first result or multi-select all of them)
Example
Based on the Elasticube below, we want to get the logged in user's ID from the Users table and add a filter for the API Calls table
// Define config settings var config = { "maxResults": 50, "filters": [ { "server": "localhost", "elasticube": "Sisense Usage", "filter": { "dim": "[API Calls.userId]", "datatype": "text", "title": "User ID" }, "queryMatch": { "dim": "[users.email]", "datatype": "text" }, "querySelection": { "dim": "[users._id]", "datatype": "text" }, "type": "first" } ] }
Notes/Reference
- In order to match the logged in user with the filter, you must use the email as it's the only unique identified for users in Sisense
Release Notes
- 11-Sep-2018 (Ronen Avidor) - update code to correct API endpoint under 7.2 release
-
Hi,
I was able to use this to create a custom filter but how do you create more than one? I tried different ways but could not add more filters.
This below is the one I created and it works but we need more filters.
// Define config settings
var config = {
"maxResults": 3000,
"filters": [
{
"server": "localhost",
"elasticube": "Sales360",
"filter": {
"dim": "[users.sales_org]",
"datatype": "text",
"title": "User_Email"
},
"queryMatch": {
"dim": "[users.sales_user]",
"datatype": "text"
},
"querySelection": {
"dim": "[users.sales_org]",
"datatype": "text"
},
"type": "first"
}
]}
-
Hi Everyone, I'm not a Sisense employee but rather an implementation partner, but I'm modifying this plugin to support several requirements of one of our clients so I can answer several questions people asked here. Feel free to reach out directly if you have any further questions to ravid@paldi.solutions
1) The plugin doesn't support configuration at the dashboard level, only the cube level. We have developed this for our client so feel free to reach out and I'll guide your developer on where hey should modify the code to support this request. modify
2) You can modify the code so it will run at the widget level but I highly recommend against that as it won't be very stable. In case you need it to run at the widget level I would suggest modifying the script to include configuration on a widget-level basis.
No, it is not possible to use this in Sisense email reports. Even if you have a developer to work on it as technically you don't have a way to interact with Sisense reporting configurations.
With that in mind, we have a developed an in-house tool that does exactly that and much more (for example you can set on a per-user basis the filter, the email title the email content, the frequency and you can even choose which widgets to be added to the email even if they are originated from different dashboards).
Feel free to reach out for more details about the tool
@John Fisher and @Eloy Meira
- You can setup many filters, on different cubes
- different dashboards will be impacted only if there are configurations for their associated cubes
- To do this, you need to add another Filter entry to the filters array. It should be something like this:
var config = {
"maxResults": 50,
"filters": [
{
## your 1st filter configurations
},
{
## your 2nd filter configurations
},
]
}Yes, it is possible to add and include all" as a fallback or any other logic that you would like to have. Feel free to reach out and I'll guide your developer on where they should modify the code to support this request
-
Anyone experiencing issues with the plugin after upgrading to 7.3?
the plugin worked fine on 7.2 but after upgrading to 7.3 we get the below error:
"Failed to load resource: the server responded with a status of 404 (Not Found)"
When opening the console, the full output of the reply object for the request to the cube is :
Could you please fix the plugin to work 7.3
Other than that, anyone else is experiencing issues with exporting dashboards to PDF? We're seeing an issue where ImageWidgets are not being rendered into the PDF when exporting the dashboard and it is fixed when de-activating the plugin (That is the reason why we upgraded to Sisense 7.3 in the first place as the support told us that it would solve it, it didn't. And instead - now the plgin doesn't work.)
-
Hi Everyone,
You can download a version with few bug fixes for the latest version of Sisense from this link.
We will be re-writing this plugin and launch an officially supported premium pluign with this funcitonlity in the near future. Please consider moving to that one in the future as we will stop supporting the community plugin soon.
Feel free to reach out for more details.
Thanks,
Ravid
Please sign in to leave a comment.
Comments
18 comments