cancel
Showing results for 
Search instead for 
Did you mean: 
Community_Admin
Community Team Member
Community Team Member
This article describes how the append dashboard filters as URL params to apply scope automatically to embedded dashboards.
 
The example below shows how to apply members as filters. 
If you already have dashboard filters defined, you can write the following command in your development console (Ctrl+Shift+I / F12 in Google Chrome ==> console tab) :
 
Type this line (this is encoding the parameters. Ignore the undefined comment you get): 
var urlParams = encodeURIComponent(JSON.stringify(prism.activeDashboard.filters

Type 'urlParams' to get the result:

%7B%22jaql%22%3A%7B%22dim%22%3A%22%5Btable_name.field_name%5D%22%2C%22datatype%22%3A%22text%22%2C%22filter%22%3A%7B%22members%22%3A%5B%22first%20value%22%2C%22second%20value%22%5D%7D%7D%7D

Append to the end of your dashboard URL "?filter=" and paste the string you got

current_dashboard_url?filter=%7B%22jaql%22:%7B%22dim%22:%22%5Barea_wise_target.Region%5D%22,%22datatype%22:%22text%22,%22filter%22:%7B%22members%22:%5B%22North%22,%22West%22%5D%7D%7D%7D
Your dashboard will be opened with the values set as filters.
If you wish to define a new scope (instead of prism.activeDashboard.filters.$$items) then:
  • Open the development console of your browser and type in:
var scope = [{
"jaql": {
 "table": "Table_Name",
 "column": "Field_Name",
 "dim": "[Table_Name.Field_Name]",
 "datatype": "text",
 "merged": true,
 "title": "Field_Name",
 "collapsed": true,
"filter": {
"members":["First Value", "Second Value"],
"explicit": false,
"multiSelection": true}
 }
}]

For multiple filters [an array of 2 or more jaql objects:]:

var scope = [{jaql:{
                     datatype:'text',
                     dim:"[Lead Generation.Country]",
                     filter:{members:["Portugal"]
                     }
                     }
                  },
                  {jaql:{
                  datatype:'text',
                  dim:"[Lead Generation.City]",
                  filter:{members:["Boston"]}
                  } 
                  } 
                ]

To use a date (time frame - this month):

"{
"dim":"[Lead Generation.Date (Calendar)]",
"datatype":"datetime",
"level":"months",
"filter":{"last":{"count":1,"offset":0}}
}"

or replace months with "days".

 
Other filter types
You can easily see the Jaql of the filter by going to "advanced" tab on the selected filter.
 
Please note that this is NOT a data-security feature and can be overridden easily by the user to view the entire data. To secure your data, please use the ElastiCube share option and data security permissions on the user/group level.
Comments
morre
7 - Data Storage
7 - Data Storage

Hi @Ophir_Buchman ,
Please fix this line:

var urlParams = encodeURIComponent(JSON.stringify(prism.activeDashboard.filters

With:

var urlParams = encodeURIComponent(JSON.stringify(prism.activeDashboard.filters.$$items));

Thanks

Version history
Last update:
‎10-18-2021 11:44 PM
Updated by:
Contributors
Community Toolbox

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

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: