cancel
Showing results for 
Search instead for 
Did you mean: 

Dashboard - Passing Filter Values Using URL Parameters

Ophir_Buchman
Sisense Team Member
Sisense Team Member

A customer may want to pass a filter value using the URL (as a parameter). A common case could be when an external system launches a dashboard and wants it to default to a specific value.

The following script allows you to parse the parameters received in the URL and apply them to the dashboard filters.

Steps:

1. Apply the following script to your dashboard:

dashboard.on('initialized', function(widget) {
// Get Parameters
urlParameters = window.location.href.substring(window.location.href.indexOf('?')+1).split('&')

// Parse Parameters
parameters = new Map();
urlParameters.forEach(function(param) { parameters.set(param.split('=')[0],param.split('=')[1]) })

prism.activeDashboard.filters.$$items.forEach(function(fil) {
if (parameters.get(fil.jaql.title) !== undefined) {
fil.jaql.filter.explicit = true
fil.jaql.filter.userMultiSelect = true
fil.jaql.filter.members = [parameters.get(fil.jaql.title)]
}
})
})

2. Acquire the URL of your dashboard
(e.g. https://test.sisense.com/app/main#/dashboards/62a...ae1)

3. Add parameters (align with filter names):
https://test.sisense.com/app/main#/dashboards/62a...ae1
?Region123=US&CountryName=Iowa

4. Refresh the dashboard and watch your filters pane:

Ophir_Buchman_0-1654805158204.png

 

3 REPLIES 3

irismaessen
9 - Travel Pro
9 - Travel Pro

That looks pretty useful and a lot more readable than passing the filter JAQL in the url -- but does this replace the filter JAQL method of setting filters in newer Sisense versions or is this an additional possibility?

Iris

Hi @irismaessen - This is a different approach to the problem...

Hey Ophir,

That's great, I'll have to investigate if this doesn't work better for us in some cases.

Thank you for the information!

Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

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

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!