Excluding from an existing Dashboard filter using BLOX
Hello,
I had an earlier challenge which was solved by Daniel (@rapidbisupport). Thank you!
Now, I'm hoping to take this one step further. After the Dashboard filter has been created, I'd like to create another BLOX button to remove specific filter entries from the list (either remove from the include or exclude) using a similar method as previous.
Here is the link to the last request / post:
Thank you in advance!
Hi ssoltz ,
You should be able to place the code directly under the initial code on the dashboard script.
This should enroll both methods to the dashboards 'domready' event - you can have multiple 'dashboard.on('domready', ()=> .....) and they won't 'overwrite each other'.
Just need to make sure none of the names assignments at the top are named the same.
Let me know how you go?
Thanks,
Daniel
RAPID BI
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons
Thanks for the Chat today ssoltz ! Was great to jump on a call and I hope you got some value out of it.
As discussed, looks like I missed a bracket in the original response, causing your adapted script to fail.
The changes required are as below:
const targetWidgetWithExclusionsResultOid = '65c2d47b874ecd0042b02068' const targetFilterTitle = 'CountryName' dashboard.on('domready', () => { $('#removeExclusionsFilterButton').on('click', () => { const targetWidgetWithExclusionsResult = prism.activeDashboard.widgets.$$widgets.find((w) => { return w.oid === targetWidgetWithExclusionsResultOid }) const targetWidgetResponse = targetWidgetWithExclusionsResult.queryResult.loadService.data.data[0].data.map((r) => { return r.value }) const targetFilter = prism.activeDashboard.filters.flatten().find((f) => { return f.jaql.title === targetFilterTitle }) delete targetFilter.jaql.filter.all targetFilter.jaql.filter.members = targetFilter.jaql.filter.members.filter((i) => { return !targetWidgetResponse.includes(i) } ) // MISSING BRACKET PREVIOUSLY prism.activeDashboard.refresh() }) })
Don't hesitate to reach out if we can help with anything else!
Thanks,
Daniel
RAPID BI
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons