BloX Template - Search box to filter 2 dimensions
BloX Template - Search box to filter 2 dimensions
This article provides a BloX template for the use case when you need a search box to be able to filter 2 dimensions at once. This solution is based on a custom action developed. See the guide for reference: Creating Custom Actions.
1. Import a Blox template attached.
2. Create a new custom action called "filterByDimensions" with the code below:
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.