cancel
Showing results for 
Search instead for 
Did you mean: 

Automated Widget Titles

Camantea
8 - Cloud Apps
8 - Cloud Apps

Hi All,

I am wondering if anyone has had any success in automating the title of a widget within a dash using the widget script. I am trying to have the title update the month automatically when a filter is applied. For example, trying to show "November Sales Trend" and have this title update when a new filter for the month of sale is selected. I found the below script would work for adjusting the title, but just need the script to grab the Current Month now.


widget.on('ready', function(w,e){
prism.activeWidget.title= 'November Venue Sales' /* this changes the title
})

Thanks in advance for any suggestions!

2 REPLIES 2

HamzaJ
12 - Data Integration
12 - Data Integration

Hey @Camantea ,

I am using the following script to achieve that. I think you need to adjust it a little bit to suit your needs:

widget.on('ready', function(w,e){ 
var currentDate = new Date();
var date = currentDate.getDate();
var month = currentDate.getMonth(); 
var year = currentDate.getFullYear();
var monthDateYear  = date + "-" + (month+1) + "-" + year;
prism.activeWidget.title='Current Date: ' + monthDateYear;
});

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @Camantea ,

Here is a post on how to update widget title based on a filter selected:

https://www.binextlevel.com/post/dynamic-widget-title-and-axis-label

 

Thanks,

Hari