Dynamically Updating Widget Titles Based on Filter Selections in Sisense (Linux)
Updated 04-24-2025
Liliia_DevX not sure if you had the chance to view this case.. :)
Hi MikeGre :)
I'm afraid there is no such solution implemented, but I'm checking internally to see if we have a similar option that could help you achieve your goal.
Hi Liliia_DevX MikeGre , please cehck the following script with added logic to detect cascading filters and read members from level.filter.members to cover the cascading filters scenario:
widget.on("render", function () {
let title = "name(s) selected";
let columnName = "Full Name"; // your reference column
// Find the filter matching the columnName (direct or inside cascading)
let filterUsed = dashboard.filters.$$items.find((filter) => {
if (filter.jaql?.column === columnName) return true;
if (filter.isCascading && filter.levels?.some((lvl) => lvl.column === columnName))
return true;
return false;
});
// Get selected values or default text
let filterText = "No";
if (filterUsed) {
if (filterUsed.isCascading) {
let level = filterUsed.levels.find((lvl) => lvl.column === columnName);
if (level?.filter?.members?.length) {
filterText = level.filter.members.join(", ");
}
} else if (filterUsed.jaql?.filter?.members?.length) {
filterText = filterUsed.jaql.filter.members.join(", ");
}
}
let isModified = false;
if (!isModified) {
widget.title = filterText + " " + title;
isModified = true;
}
});
I use the "Full Name" column in this example, and the default value is "No name(s) selected", where No is replaced with the actual value(s) if they are selected. Feel free to adjust it according to your needs.