Using BloX to enable or disable Pivot rows in Sisense dashboards (Linux)
Using BloX to enable or disable pivot rows in Sisense dashboards (Linux)
Step-by-Step Guide
To enable or disable a row in a Pivot widget using BloX, follow these steps:
1. Create a Custom Action in BloX:
- Open the BloX widget in edit mode.
- Click on the three-dot icon.
- Select "Create Action" and name it manageRows.
2. Insert Action Code:
- Copy and paste the following code snippet into the action creation area:
let widgets = payload.widget.dashboard.widgets.$$widgets;
let pivotWidgets = widgets.filter(widget => widget.type === 'pivot2');
pivotWidgets.forEach(widget => {
let panel = widget.metadata.panels.find(p => p.name === 'rows');
if (!panel) return;
// Replace [Commerce.Condition] with the dimension of the row to be managed.
let item = panel.items.find(i => i.jaql ?.dim === '[Commerce.Condition]');
if (!item) return;
item.disabled = !item.disabled;
widget.changesMade('pivotchanged', ['metadata']);
widget.refresh();
});
3. Configure the Action Parameters:
- Add the following action parameters in the second step:
{
"type": "manageRows",
"title": "title"
}
4. Apply the Action:
- Click "Create" and then "Apply" to save your custom action.
5. Import the Dashboard:
- Import the provided dashboard, which is based on the sample cube "Sample ECommerce" and contains a BloX widget with the script that utilizes the created action, and also two Pivot widgets for testing purposes.
6. Test the Button:
- Use the "ChangePivot" button within the dashboard to toggle the visibility of the "Condition" row.
Conclusion:
By following this guide, you can create interactive dashboards that allow users to enable or disable pivot rows with a simple button click. This functionality enhances the user experience by providing dynamic interaction with the data.
References/Related Content
Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this, please let us know.