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

Dynamically Updating Widget Titles Based on Filter Selections in Sisense (Linux)

Introduction

This article guides how to dynamically change the title of a Sisense widget based on the filter selection. While this is an advanced solution and not natively supported by Sisense functionality, a custom script can be used to achieve this effect. Please proceed with caution, as this is a custom implementation.

 
Screenshot 2025-03-05 at 9.31.08 AM.png[ALT Text: A dashboard display titled "Europe, USA (by Region)" showing a gauge indicating an "Actual Margin" of 0.22. The gauge ranges from -0.25 to 0.25. A sidebar lists regions: Europe, N/A, and USA, with checkboxes next to each.]

Step-by-Step Guide

  • Navigate to the desired dashboard in Sisense and select the widget you want to change the title dynamically.
  • Open the widget's settings and access the script editor under the 3 dots menu > Edit Script.
  • Copy and paste the following code into the widget's script editor:

 

 

widget.on("render", function () {
  let title = "by Region";  // Set a default title
  
  // Find the specific filter by its column name
  let filterUsed = dashboard.filters.$$items.find(
    (filter) => filter.jaql.column === "Region"
  );
  
  // Determine the filter text or set default
  let filterText =
    filterUsed && filterUsed.jaql.filter.members?.length
      ? filterUsed.jaql.filter.members.join(", ")
      : "All Regions";
  
  // Flag to prevent multiple updates
  let isModified = false;
  
  if (!isModified) {
    widget.title = filterText + ' ' + title;
    isModified = true;
  }
});

 

 

 

 

  • Adjust the filter.jaql.column value instead of "Region" in the script to match the actual filter you intend to use.
  • Update the default title instead of  "by Region".
  • Modify the "All Regions" value to be displayed for the “Include All” filter. 
  • Save the changes in the script editor.
  • Apply different filter selections on your dashboard to verify that the widget title updates according to the chosen filters.

Troubleshooting and Limitations:

  • Ensure that the filter column specified in the script matches an existing filter on the dashboard.
  • The script works only for filters of include type. For excluding filters the additional logic should be implemented. 

Conclusion

By following the steps outlined above, you can set up your Sisense widget titles to dynamically update based on filter selections. While this approach offers flexibility, it involves a custom script and requires careful handling, as modifications made this way are outside Sisense's standard support.


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.

Rate this article:
Version history
Last update:
‎03-05-2025 07:35 AM
Updated by: