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 me to search one column. I created multiple buttons to search and clear each column. Is it possible to create one button that searches all buttons? Here is an image of the Search Field widget with my current implementation:
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()
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:
- Click the three-dot menu button of the browser (Chrome) in the top right corner
- Select More Tools
- Select Developer Tools
- Click the Console tab
- Click the BloX button and check if there is any message on the Console window