cancel
Showing results for 
Search instead for 
Did you mean: 
Liliia_DevX
Sisense Team Member
Sisense Team Member

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.

jcordell_0-1695933061649.png

 

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".

jcordell_1-1695933061210.png

 

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.

Version history
Last update:
‎09-28-2023 01:33 PM
Updated by:
Community Toolbox

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

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: