BloX Template - Search box to filter 2 dimensions
BloX Template - Search box to filter 2 dimensions
const searchInput = document.getElementById('bloxFiltersInput').getAttribute('value')
if (searchInput) {
payload.data.filters.forEach(filterName => {
payload.widget.dashboard.filters.$$items.find(f => f.jaql.title === filterName).jaql.filter = {}
payload.widget.dashboard.filters.$$items.find(f => f.jaql.title === filterName).jaql.filter.contains = searchInput
})
payload.widget.dashboard.filters.update(payload.widget.dashboard.filters.$$items, {
refresh: true,
save: true
})
}3. Press "Next" button and paste the following code:
{
"type": "filterByDimensions",
"title": "title",
"data": {
"filters": "filters"
}
}4. Click on "Create".
5. Navigate to the "Editor" tab and update "filters" array to include your dashboard filter titles. In our case, it's "Brand" and "Category".
Now test it out and feel free to use it as an example to develop your own solutions, and drop a comment with your experience! 😊
Disclaimer: Please note that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding, which is outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.
Rafael Ferreira
·1 year agoHi Liliia_DevX
That did the trick, thank you.
I also wanted to make a note for anyone reading the article. Once the filter is applied you can go to the relationship editor and make this an OR statement so it searches in either column.
Liliia Kislitsyna
AdminOP1 year agoAstroraf hi! Thanks for sharing your feedback.
Could you please check if the dashboard filters are disabled for the Blox widget? To do so, open your Blox widget in the Edit mode -> move to filters and disable the dashboard filters there:
Hope that helps! 🙂
Best Regards, Lily
Rafael Ferreira
·1 year agoHi Liliia_DevX ,
Thanks for this great example with a 2-dimensional filter. The only issue is when you apply a term that is not related the BloX widget goes blank and you have to clear the filter from the dashboard filter on the side. I have added this reset button, but again when I search for a term that is not related the BloX filter goes blank. Is there a work around to this?