How can i pull the filter value to dashboard using a script in sisense
-
Thanks @Nathan Giusti
-
I copied Nathan's code from 7/31/2019 into a Dashboard script but there was an error with a misplaced ")".
After fixing that I got "ReferenceError: widget is not defined"
So a moved the code into a Widget script of a widget contained within the dashboard and it kinda worked.
The dashboard has 2 filters, a date and a pick list of 6 options (lines of business).
The date filter value is displayed on the console perfectly
But the pick list values are displayed as "undefined"
I'll keep fiddling with it, if anyone has any other ideas please post - cheers
Here's the amended code I used:
widget.on("initialized", function (se, args){
prism.activeDashboard.filters.$$items.forEach(
(itemFilter) =>{
console.log(itemFilter.jaql.filter.members)
}
)
}) -
Hey Stephen,
Sorry for the typo.
If you want to put it in a widget script you'd use the widget.on syntax. If you want it in a dashboard script, you would use the dashboard.on syntax
Members only has values if you are filtering for a specific value. The exact structure for the itemFilter.jaql.filter object changes depending on the filter selected. It may be worth running something like
dashboard.on("initialized", function (se, args){
prism.activeDashboard.filters.$$items.forEach((itemFilter) =>
{
console.log(itemFilter.jaql.filter)
}
)})
And looking at the results in your console to see what structure the filters you are looking at are in. -
Use a filter action in blox
https://documentation.sisense.com/latest/blox/bloxreference.htm#gsc.tab=0
Please sign in to leave a comment.
Comments
11 comments