Recent Content
How to add temporary per-cell highlighting and comments in Sisense Pivot Widgets [Linux]
Step-by-Step Guide 1. What does this solution do? This approach adds two main features to Table or Pivot widgets: Highlighting: Click any cell to toggle a background color highlight (persists for your browser/user profile). Commenting: Double-click any cell to add or edit a comment. Comments are stored per-cell and appear as tooltips on hover for easy review. 2. Where do the highlights and comments live? Both highlights and comments are safely stored in your browser’s local storage. They remain until your local storage data is cleaned either manually or automatically. Feel free to change this according to your needs. 3. How to implement 1. Open your dashboard, select the widget (Pivot) you wish to enhance, and go to the widget script. Select the widget. Click the menu (three dots) and choose "Edit Script." 2. Paste this JavaScript (Widget Script) code in: /* One click to highlight the cell Two clicks to add/edit comment */ widget.on('ready', function(w, args) { // Helper to build a unique cell based on contents (cell value makes it unique) function getCellContent(td) { var $td = $(td); var $tr = $td.closest('tr'); var colIdx = $td.index(); var dimCols = widget.queryResult.headers ? widget.queryResult.headers.length : 1; var dimensions = []; $tr.find('td').each(function(i, cell) { if(i < dimCols) { dimensions.push($(cell).text().trim()); } }); var colHeader = ''; var headerRows = $('table thead tr'); if (headerRows.length > 0) { var headerCells = headerRows.last().children('th,td'); colHeader = $(headerCells).eq(colIdx).text().trim(); } var cellVal = $td.text().trim(); return JSON.stringify({dims: dimensions, col: colHeader, val: cellVal}); } // Local Storage Handling var highlights = JSON.parse(localStorage.getItem('sisense_table_highlights') || '{}'); var comments = JSON.parse(localStorage.getItem('sisense_table_comments') || '{}'); // Initial render of highlights and tooltips $('td').each(function() { var cellContent = getCellContent(this); if (highlights[cellContent]) { $(this).css('background', '#94F5F0'); } else { $(this).css('background', ''); } // Set browser tooltip for comments if (comments[cellContent] && comments[cellContent].length > 0) { $(this).attr('title', comments[cellContent]); } else { $(this).removeAttr('title'); } }); // Cell click: highlight/unhighlight $('td').off('click.table-highlight').on('click.table-highlight', function(e) { var cellContent = getCellContent(this); highlights[cellContent] = !highlights[cellContent]; localStorage.setItem('sisense_table_highlights', JSON.stringify(highlights)); $(this).css('background', highlights[cellContent] ? '#94F5F0' : ''); }); // Cell double-click: open modal for comment add/edit $('td').off('dblclick.table-comment').on('dblclick.table-comment', function(e) { var cellContent = getCellContent(this); var currentComment = comments[cellContent] || ''; showModal(cellContent, currentComment, $(this)); }); // Modal for add/edit comment function showModal(cellContent, currentComment, $td) { $('body').find('.sisense-table-modal').remove(); var bg = '#fff'; var text = '#3a4356'; var primary = '#94F5F0'; var secondary = '#f5f5f5'; var $modal = $(` <div class="sisense-table-modal" style=" position:fixed;top:0;left:0;right:0;bottom:0; background:rgba(0,0,0,0.18);z-index:9999;display:flex;justify-content:center;align-items:center;"> <div style=" background:${bg}; color:${text}; padding:24px; border-radius:8px; min-width:340px; box-shadow:0 2px 18px rgba(0,0,0,0.18);"> <div style="font-size:18px;margin-bottom:12px;">Add/Edit Comment</div> <textarea id="comment-textarea" style=" width:100%;height:80px;font-size:14px; padding:8px;border:1px solid #e0e0e0;border-radius:4px; margin-bottom:18px;background:${secondary};color:${text}; ">${currentComment}</textarea> <div style="text-align:right;"> <button id="sisense-comment-cancel" style=" background:${secondary};color:${text};border:none; padding:8px 18px;margin-right:4px;border-radius:3px; font-size:14px;cursor:pointer;">Cancel</button> <button id="sisense-comment-save" style=" background:${primary};color:${text};border:none; padding:8px 18px;border-radius:3px;font-size:14px; font-weight:bold;cursor:pointer;">Save</button> </div> </div> </div> `); $('body').append($modal); $('#sisense-comment-cancel').on('click', function() { $modal.remove(); }); $('#sisense-comment-save').on('click', function() { var newComment = $('#comment-textarea').val(); comments[cellContent] = newComment; localStorage.setItem('sisense_table_comments', JSON.stringify(comments)); // Update the cell tooltip immediately! if (newComment.length > 0) { $td.attr('title', newComment); } else { $td.removeAttr('title'); } $modal.remove(); }); } }); Screenshot: Example of a cell being highlighted and the modal for comment entry. Description: Shows a highlighted cell and the add/edit comment modal in action on a Table widget. 3. Now you can highlight cells by clicking on them, add/edit comments by double clicking, and easily visualize the comments by hovering over them. Usage tips Highlighting and comments are per browser, user, and cell, meaning other users will not be able to see what you do (both persist until local storage is cleared). Hover over a cell to see its comment. Cells with no comments/tooltips show the default content. You may style the modal and highlight color for your organization’s palette. Feel free to use this script as a foundation and adapt it to create a customized solution tailored to your organization’s needs. For example, you could extend the functionality by integrating additional code that synchronizes highlights and comments with a database, ensuring they persist across different users and devices instead of remaining temporary in each browser. Conclusion This solution enables deeper interactivity by allowing any dashboard user to quickly annotate and highlight data cells temporarily (only visible for them and available until Local Storage is cleaned) in Pivot widgets within Sisense, without leaving the dashboard context. It requires no backend integration and works across all standard dashboard deployments. 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.0likes0CommentsHow to dynamically change date view and format with buttons [Linux]
Step-by-step Guide 1. Create or navigate to a widget of your choice with one of the types previously mentioned and open the script editing screen. 2. Next, enter the following script: widget.on("domready", function(se, ev) { const widgetId = widget.oid; const containerSelector = prism.activeWidget ? $('.highcharts-container') : $(`widget[widgetid=${widgetId}] .highcharts-container`); // Remove old buttons if they exist $("#toggle-date-buttons-" + widgetId).remove(); // Create button container const buttonsHtml = ` <div id="toggle-date-buttons-${widgetId}" style="display:flex;justify-content:center;align-items:center;margin-bottom:16px;margin-top:5px;"> <button id="weekly-btn-${widgetId}" style="margin-right:10px;cursor:pointer; background:#94F5F0; border:none; border-radius:4px; padding: 7px;">Weekly view</button> <button id="monthly-btn-${widgetId}" style="cursor:pointer; background:#94F5F0; border:none; border-radius:4px; padding: 7px;">Monthly view</button> </div> `; // Insert button container before the chart containerSelector.before(buttonsHtml); // Button listeners const defaultPanel = widget.metadata.panels[0]; $(`#weekly-btn-${widgetId}`).on('click', () => { if (defaultPanel && defaultPanel.items && defaultPanel.items.length > 0) { defaultPanel.items[0].jaql.level = 'weeks'; // Date level you want to change to defaultPanel.items[0].format = defaultPanel.items[0].format || {}; defaultPanel.items[0].format.mask = defaultPanel.items[0].format.mask || {}; defaultPanel.items[0].format.mask.weeks = 'MMM dd'; // Format you want to show delete defaultPanel.items[0].format.mask.isdefault; widget.refresh(); } }); $(`#monthly-btn-${widgetId}`).on('click', () => { if (defaultPanel && defaultPanel.items && defaultPanel.items.length > 0) { defaultPanel.items[0].jaql.level = 'months'; // Date level you want to change to defaultPanel.items[0].format = defaultPanel.items[0].format || {}; defaultPanel.items[0].format.mask = defaultPanel.items[0].format.mask || {}; defaultPanel.items[0].format.mask.months = 'MMM'; // Format you want to show delete defaultPanel.items[0].format.mask.isdefault; widget.refresh(); } }); }); 3. You should see a similar result if using a Line Chart: 4. If you click weekly view, the date view and format should change accordingly to what you configured: 5. And if you click Monthly view, it should do the same, but for what you configured for the monthly view: Conclusion By following the steps above, you can easily enable end-users to switch between different date views and formats using custom buttons in Sisense widgets. This interactive approach improves dashboard usability and empowers users to analyze data in the context most relevant to their needs. 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.0likes0CommentsBlanking out grand totals and subtotals for specific columns in Sisense pivot tables [Windows]
Step-by-Step Guide: 1. Install the following plugin: Grand/Subtotals for Specific Values in Pivot Widget Plugin This plugin lets you control which columns display grand totals and subtotals. However, in some setups, the totals for excluded columns appear as 0 instead of being hidden. To fix that, we’ll add a script that visually blanks out those zeros. 2. In your widget’s script editor, add this code directly below the plugin activation line: prism.registerControlSubGrandTotal(widget); //line to activate the plugin from step 1 var columns = [3, 4]; // Specify date columns (zero-based index) widget.on('ready', function (se, ev) { $.each(columns, function (index, value) { var num = $("tbody tr:first", element).children().length - value; $("tbody tr:has(.p-total-row-val)", element).each(function () { var cell = $(this).children().last(); for (var a = 0; a < num; a++) { cell = cell.prev(); } var numericValue = Number(cell.text()); // Only blank zeros in totals if (numericValue === 0) { $(cell).css("color", "white"); } }); }); }); How to Add the Script Open your Pivot widget. Click Edit (pencil icon). Click the three dots in the top-right corner → Edit Script. Paste the code below the plugin activation line. Click Save. What This Script Does This snippet turns 0 values white, effectively hiding them in totals/subtotals. Just update: var columns = [3, 4]; …with the zero-based indexes of the columns whose totals you want to hide. References/Related Content Grand/Subtotals For Specific Values In Pivot Widget: https://community.sisense.com/kb/add-ons_and_plug-ins/grandsubtotals-for-specific-values-in-pivot-widget/9131 Change the background color of the Pivot cell on value Windows: https://community.sisense.com/kb/widget_and_dashboard_scripts/change-the-background-color-of-the-pivot-cell-on-value-windows/24819 Note: Verified on W20.24.9 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.0likes0CommentsHow to highlight top X values in Pivot tables using custom script [Linux]
Step-by-step Guide 1. Navigate to your preferred Pivot Table widget and open the script editing screen. 2. Next, enter the following script: const targetCols = [0,3,6]; // Targeted columns for analysis const columnValues = {}; const highestValues = {}; let initialized = false; const amountOfTopValues = 4; // Pass 1: Gather numeric values for target columns widget.transformPivot({}, (meta, cellData) => { // CLEAR columnValues before starting to accumulate values if (meta.rowIndex === 0 && meta.colIndex === 0) { targetCols.forEach(colIdx => columnValues[colIdx] = []); } if ( targetCols.includes(meta.colIndex) && meta.rowIndex > 0 && !meta.type.includes('grandtotal') && !meta.type.includes('subtotal') ) { if (!columnValues[meta.colIndex]) columnValues[meta.colIndex] = []; const numericVal = parseFloat(cellData.content.toString().replace(/,/g,"")); if (!isNaN(numericVal)) { columnValues[meta.colIndex].push({ num: numericVal, pos: meta.rowIndex }); } } }); // Pass 2: Highlight the two highest per column widget.transformPivot({}, (meta, cellData) => { if (targetCols.includes(meta.colIndex) && highestValues[meta.colIndex]) { const currentVal = parseFloat(cellData.content.toString().replace(/,/g,"")); const isHigh = highestValues[meta.colIndex].some(entry => entry.num === currentVal && entry.pos === meta.rowIndex ); if (isHigh) { cellData.style = cellData.style || {}; cellData.style.background = 'LightSalmon'; cellData.style.fontWeight = 'bold'; } } }); function calculateTopValuesAndRefresh() { targetCols.forEach(colIdx => { const entries = columnValues[colIdx] || []; const sorted = entries.slice().sort((x, y) => y.num - x.num); highestValues[colIdx] = sorted.slice(0, amountOfTopValues); }); if (!initialized) { initialized = true; setTimeout(function() { widget.refresh(); },4000); } } // Pass 3: Define button to highlight highest values and refresh the widget widget.on("ready", () => { calculateTopValuesAndRefresh(); let widgetElement = document.querySelector('[widgetid="' + widget.oid + '"]'); if (widgetElement) { let widgetContainer = widgetElement.querySelector('.widget-body'); if (widgetContainer) { // Don’t add the button multiple times if (!widgetContainer.querySelector('.highlight-top-btn')) { const button = document.createElement('button'); button.textContent = "Highlight Top Values"; button.className = "highlight-top-btn"; button.style.display = "block"; button.style.margin = "5px 0 0 10px"; button.style.background = "#94F5F0"; button.style.border = "none"; button.style.borderRadius = "4px"; button.style.visibility = "visible"; button.style.cursor = "pointer"; button.onclick = function() { calculateTopValuesAndRefresh(); widget.refresh(); }; widgetContainer.insertBefore(button, widgetContainer.firstChild); } } } }); 3. Please visit your dashboard and look at your widget. You will see a display similar to the following: 4. The highest four values, or your selected amount, will be highlighted in each column specified in the target columns. 5. If you modify the order or make changes to the rows in the widget, the highlighted values may not update automatically. To refresh the highlights, simply click the blue "Highlight Top Values" button whenever needed. References/Related Content The Pivot 2.0 API documentation can be accessed here: https://developer.sisense.com/guides/customJs/jsApiRef/widgetClass/pivot2.html#transformpivot Conclusion This code allows you to customize your Pivot Table widgets to consistently highlight the top values of your chosen columns. If your data changes, you can easily use the "Highlight Top Values" feature to update the highlights at any time. 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.0likes0CommentsHow to create a custom button in your Pivot table [Linux]
Step-by-step Guide 1. Navigate to your preferred Pivot Table widget and open the script editing screen. 2. Next, enter the following script: widget.on("ready", () => { let widgetElement = document.querySelector('[widgetid="' + widget.oid + '"]'); if (widgetElement) { let widgetContainer = widgetElement.querySelector('.widget-body'); if (widgetContainer) { // Don’t add the button multiple times if (!widgetContainer.querySelector('.highlight-top-btn')) { const button = document.createElement('button'); button.textContent = "Refresh Widget"; // Display name inside the button button.className = "highlight-top-btn"; button.style.display = "block"; button.style.margin = "5px 0 0 10px"; button.style.background = "#94F5F0"; button.style.border = "none"; button.style.borderRadius = "4px"; button.style.visibility = "visible"; button.style.cursor = "pointer"; //Use this as a workaround to readjust the widget height in case you have too many buttons, or if they are big enough to start cutting the end of the widget. //It is not guaranteed this will work in all scenarios. //widgetElement.style.height = "auto"; button.onclick = function() { //Any functions, actions, or custom code you want to call when the button is clicked, in this example we will call a simple widget refresh event widget.refresh(); }; widgetContainer.insertBefore(button, widgetContainer.firstChild); } } } }); 3. You should see a similar result, and when you click the button, the action you set in the onclick function will be performed. In our example, this will simply refresh the widget. Conclusion Using and adapting this script, you can create custom buttons and add them to the top of your Pivot Table Widgets, allowing you to perform your preferred actions with ease. 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.0likes0CommentsPivot widget-based anomaly/threshold warning [Linux]
Step-by-step Guide 1. Navigate to your preferred Pivot Table widget and open the script editing screen. 2. Next, enter the following script: // Configuration: columns and their thresholds const thresholdCols = [ { idx: 0, threshold: 500, columnName: 'Cost' }, { idx: 3, threshold: 100, columnName: 'Brand ID' }, ]; // This will store all [rowIdx, colIdx] pairs to highlight let warningCells = []; function fetchAllDataAndShowWarnings(cubeName, jaqlQuery) { const $internalHttp = prism.$injector.has("base.factories.internalHttp") ? prism.$injector.get("base.factories.internalHttp") : null; $internalHttp({ url: `/api/datasources/${cubeName}/jaql`, method: "POST", data: jaqlQuery, contentType: "application/json", dataType: "json" }, true) .then(result => { // Initialize warning counts and cell positions let warningCounts = {}; thresholdCols.forEach(colConfig => warningCounts[colConfig.idx] = 0); warningCells = []; // Reset if (result && result.values) { result.values.forEach((row, rowIdx) => { thresholdCols.forEach(colConfig => { const cell = row[colConfig.idx]; const val = parseFloat(cell.data); if (!isNaN(val) && val > colConfig.threshold) { warningCounts[colConfig.idx]++; warningCells.push({ rowIdx, colIdx: colConfig.idx }); } }); }); } // Build warning details const warningDetails = thresholdCols .filter(colConfig => warningCounts[colConfig.idx] > 0) .map(colConfig => `${warningCounts[colConfig.idx]} value${warningCounts[colConfig.idx] > 1 ? "s" : ""} exceed ${colConfig.threshold} in "${colConfig.columnName}"` ); showCentralWarningBanner(warningDetails, Object.values(warningCounts).reduce((a,b)=>a+b,0)); highlightWarningCells(); }) .catch(err => console.error("HTTP error:", err)); } function showCentralWarningBanner(warningDetails, totalWarnings) { let widgetElement = document.querySelector('[widgetid="' + widget.oid + '"]'); if (widgetElement) { widgetElement.style.height = "auto"; let widgetContainer = widgetElement.querySelector('.widget-body'); if (widgetContainer) { let existingBanner = widgetContainer.querySelector('.pivot-warning-banner'); if (existingBanner) existingBanner.remove(); if (totalWarnings > 0) { const banner = document.createElement('div'); banner.className = 'pivot-warning-banner'; banner.style.display = 'flex'; banner.style.justifyContent = 'center'; banner.style.alignItems = 'center'; banner.style.background = '#fff3cd'; banner.style.color = '#856404'; banner.style.padding = '8px 12px'; banner.style.border = '1px solid #ffeeba'; banner.style.borderRadius = '5px'; banner.style.marginBottom = '8px'; banner.style.fontSize = '15px'; banner.style.width = '100%'; banner.style.position = 'relative'; banner.innerHTML = ` <span style="font-size:20px; font-weight:bold; margin-right:6px;cursor:pointer;" class="warning-detail-icon" title="Show details">⚠ ${totalWarnings} Warning${totalWarnings === 1 ? "" : "s"}</span> `; // Tooltip const tooltip = document.createElement('div'); tooltip.className = 'pivot-warning-tooltip'; tooltip.style.display = 'none'; tooltip.style.position = 'absolute'; tooltip.style.left = '120px'; tooltip.style.top = '36px'; tooltip.style.background = '#ffffe0'; tooltip.style.color = '#856404'; tooltip.style.border = '1px solid #ffeeba'; tooltip.style.borderRadius = '5px'; tooltip.style.padding = '8px 14px'; tooltip.style.fontSize = '14px'; tooltip.style.zIndex = 9999; tooltip.style.maxWidth = '320px'; tooltip.style.boxShadow = '0 4px 8px rgba(0,0,0,0.06)'; tooltip.innerHTML = warningDetails.length > 0 ? warningDetails.join('<br>') : 'No threshold exceeded.'; banner.appendChild(tooltip); banner.querySelector('.warning-detail-icon').addEventListener('mouseenter', () => { tooltip.style.display = 'block'; }); banner.querySelector('.warning-detail-icon').addEventListener('mouseleave', () => { tooltip.style.display = 'none'; }); banner.addEventListener('mouseleave', () => { tooltip.style.display = 'none'; }); widgetContainer.insertBefore(banner, widgetContainer.firstChild); } } } } // Highlight warning cells in the visible pivot table function highlightWarningCells() { let widgetElement = document.querySelector('[widgetid="' + widget.oid + '"]'); if (!widgetElement) return; // For each threshold column thresholdCols.forEach(colConfig => { // Select all cells with the correct col index const selector = `.table-grid__cell--col-${colConfig.idx}`; let cells = widgetElement.querySelectorAll(selector); cells.forEach(cellElem => { // Get the cell text and parse as float const val = parseFloat(cellElem.innerText.replace(/[^\d.-]/g,"")); if (!isNaN(val) && val > colConfig.threshold) { cellElem.style.background = 'LightSalmon'; cellElem.style.fontWeight = 'bold'; } else { cellElem.style.background = ''; cellElem.style.fontWeight = ''; } }); }); } // Run your API-driven warning calc when widget is ready widget.on("ready", () => { const cubeName = widget.datasource.title; const jaqlQueryObj = prism.debugging.GetJaql(widget); fetchAllDataAndShowWarnings(cubeName, jaqlQueryObj); }); 3. In your widget, you will see a display similar to the following: 4. At the top of your pivot table, you'll find a notification showing how many values exceed the thresholds you've set for each column. By hovering over the notification, you can view the exact number of values for each column. These values are also highlighted within your table for easy reference. References/Related Content The REST API reference guide can be accessed here: https://developer.sisense.com/guides/restApi/v0/?platform=linux&spec=L2025.2#/query-rest-controller/executeQueryStream Token-related documentation: https://docs.sisense.com/main/SisenseLinux/sisense-bearer-tokens.htm Conclusion This script provides a straightforward method to monitor and highlight data threshold violations in your Sisense Pivot Table widgets. By automatically generating warnings and visually marking affected cells, it enhances data visibility and helps users quickly identify outliers. We recommend thoroughly testing this solution within your environment to ensure compatibility with your Sisense instance and data models. 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.0likes0CommentsAuto Refresh Dashboard Based On Elasticube Build Or Refresh Every Dashboard Widget
Add this to a dashboard script: // Specify the required parameters var reloadType = 'page'; // 'dashboard' (dashboard refresh only) or 'page' (entire page reload) var checkInterval = 15; // checking interval in seconds //Variables + Settings to check elasticube build on the server var cubeName = dashboard.datasource.title; var encodedCubeName = encodeURIComponent(cubeName); var revision = null; var settings = { "async": true, "crossDomain": true, "url": "/api/v1/elasticubes/live/by_title/" + encodedCubeName, "method": "GET", "headers": { "Content-Type": "application/json" } } //The function to look up the revision history of the build. If the revision changes, a build had occurred and the auto-refresh is triggered function checkElasticubeBuildStatus(){ console.log("Checking cube status...") $.ajax(settings).done(function (response) { if(revision === null) { console.log("Initial dashboard load."); } else if(revision != response.lastBuildTime) { console.log("Cube has recently been updated. Reloading the dashboard..."); if(reloadType === 'page') { location.reload(); } else if (reloadType === 'dashboard') { dashboard.refresh(); } } else { console.log("Cube has not been updated."); } revision = response.lastBuildTime; console.log("Check completed. Next check in " + checkInterval + " seconds."); setTimeout(checkElasticubeBuildStatus, checkInterval*1000); }); } //Run the function to recursively check build status checkElasticubeBuildStatus(); Auto-refresh dashboard at a set interval: This script auto-refreshes the dashboard at a set interval. The example below is configured to refresh all widgets every 60 seconds. Add this to a dashboard script // Specify the required parameters var reloadType = 'dashboard'; // 'dashboard' (dashboard refresh only) or 'page' (entire page reload) var refreshInterval = 10; // refresh interval in seconds dashboard.on('initialized', function(dashboard, ev){ var refreshDashboard = function(){ if(reloadType === 'page') { location.reload(); } else if (reloadType === 'dashboard') { dashboard.refresh(); } setTimeout(refreshDashboard, refreshInterval*1000); } setTimeout(refreshDashboard, refreshInterval*1000); })0likes1CommentConditionally Hide Widgets
The example below uses a "peer group" use case, where a company which facilitates customer peer benchmarking, does not want users to compare themselves to fewer than 10 companies. The first widget, either an indicator or BloX widget, will supply the condition for the dashboard. When the value is lower than the user-set threshold, all other widgets get hidden. Base Configuration Open the Dashboard Script view and paste the following code inside. Edit the masterWidgetId and threshold variable in the following script: Dashboard Script Part 1: //----- Configuration ----------------------------------------------- let masterWidgetId = '<WidgetID here wrapped in single quotes>'; let threshold = <your integer threshold here>; //------------------------------------------------------------------------- HOW TO ACCESS THE WIDGETID You can access the ID by opening a widget's edit mode and taking the id after the widgets/ part inside the URL. URL: ...dashboards/<DashboardID>/widgets/<WidgetID>/ SETTING THE THRESHOLD If the value of the indicator or first value in the blox widget is less than the value of your threshold variable, then other widgets of the dashboard will be hidden. Completing The Script The next piece of the code depends on which widget type you use. You can use both Indicator and BloX widget types. Indicator Widget As Master Widget If your leading or Master widget is an indicator, paste the following code after the configuration code you pasted earlier. Dashboard Script Part 2a (for indicator) let isHidden = 0; dashboard.on('refreshend', (args, el) => { let masterWidget = args.widgets.$$widgets.find(w => w.oid === masterWidgetId); let logicValue = masterWidget.queryResult.value.data; if (logicValue < threshold){ $( 'widget' ).not( "[widgetid="+masterWidgetId+"]").slideUp(200); isHidden = 1; } else { if ( isHidden == 1){ $('widget').slideDown(200, ()=>{dashboard.refresh();}); isHidden = 0; } } }); BloX As Master Widget If your leading or Master widget is a BloX widget, paste the following code after the configuration code you pasted earlier. Dashboard Script Part 2b (for BloX) let isHidden = 0; dashboard.on('refreshend', (args, el) => { let masterWidget = args.widgets.$$widgets.find(w => w.oid === masterWidgetId); let logicValue = masterWidget.queryResult[0][0].Value; if (logicValue < threshold){ $( 'widget' ).not( "[widgetid="+masterWidgetId+"]").slideUp(200); isHidden = 1; } else { if ( isHidden == 1){ $('widget').slideDown(200, ()=>{dashboard.refresh();}); isHidden = 0; } } }); Now save the script and refresh the dashboard for the script to take effect. Enjoy!0likes1CommentEnsuring Accurate PDF Export Headers When Programmatically Modifying Dashboard Filters in Sisense
When working with Sisense dashboards, programmatically modifying filters upon dashboard load via dashboard scripts for a specific user or circumstance is possible. However, an issue can sometimes occur when exporting these dashboards to PDF immediately after such modifications: the filter header displayed at the top of the exported PDF displaying the current dashboard filter state may not accurately reflect the current state of the dashboard filters. This article explains the cause of this issue and presents a solution to ensure that PDF exports display the correct filter information in the header.How to handle or disable widget selection behavior in Sisense [Linux]
In Sisense, you can click specific portions of most widgets (except for table and indicator widgets) to select the widget's portion. This will apply filters in the dashboard according to the selected data by adding a filter, but with some lesser-known methods, you can modify or disable this behavior.0likes1Comment