Forum Discussion

janaya71's avatar
janaya71
Cloud Apps
02-13-2025
Solved

Blox Search Field usage for multiple columns

Hi, I'm creating a dashboard with a table with multiple columns containing text.  I've created individual filters for the columns.  I tried adding the Blox Search Field widget but it is only allowing...
  • TriAnthony's avatar
    TriAnthony
    02-20-2025

    janaya71 is the below script the same script you're currently using for the BloX custom action? If so, all you need to do is add the three fields into the BloX widget, because the script is already set to loop through all slicer fields (those under "Items" on the left panel).

    By default all filters are combined with an AND logic, but this can be changed using Filter Relationship. If this feature is not already turned on, you can enable it in the Admin page (App Configuration -> Feature Management -> Filters -> Filter Relationship). This is an example of a customized filter relationship where three filters (Brand, Category, and Country) are combined using OR, and then the result of it is combined using AND with all other filters:

    I also attached a dashboard file that demonstrates this example using the Sample ECommerce cube. Note that you need to change the file extension from .txt to .dash before importing it into your environment, and the Filter Relationship feature needs to be enabled.

    SearchBar BloX custom action:

     

    //Variable that stores the Data Source
    var dataSource = payload.widget.datasource
    //Variable that stores the user input
    var userInput = payload.data.userInput;
    
    payload.widget.metadata.panels[0].items.forEach(function(item){
        var column = item.jaql.column
        var dimension = item.jaql.dim
        var table = item.jaql.table
        var title = item.jaql.title
    
        //Variable that stores the JAQL to add
        var topJAQL = {
            jaql:{
                        datasource: dataSource,
                        table: table,
                        column: column,
                        dim: dimension,
                        datatype: "text",
                        merged: true,
                        title: title,
                        filter: {
                            "contains": userInput
                        }				
                }
            }
    
        payload.widget.dashboard.filters.update(topJAQL)
    })
    
    payload.widget.dashboard.refresh()
    

     

  • TriAnthony's avatar
    TriAnthony
    02-28-2025

    janaya71 Did you add the three filter fields to the BloX widget? They need to be added into the Items section on the left panel. If they are already added and the button is still not working, could you check the browser console, and see if there is any error message when you click the button?

    To do this:

    1. Click the three-dot menu button of the browser (Chrome) in the top right corner
    2. Select More Tools
    3. Select Developer Tools
    4. Click the Console tab
    5. Click the BloX button and check if there is any message on the Console window