cancel
Showing results for 
Search instead for 
Did you mean: 

Create a widget filter based on dashboard filter

Akhila
8 - Cloud Apps
8 - Cloud Apps

There is a dashboard filter of months. If month jan’22 is selected, i need to get data not only from jan’22 but till jan’22. Currently my dashboard is returning only jan’22 data. Is there is any script for this implementation?

3 REPLIES 3

harikm007
13 - Data Warehouse
13 - Data Warehouse

@Akhila ,

Please check if this script gives you expected result (add this script to the widget where you want to see data till selected date and update the variable 'columnName' with field name):

widget.on('beforequery', function(se, ev){

	columnName = 'DATE_OF_JOINING'//replace this with your field name
	dashdatefilter = ev.widget.dashboard.filters.$$items.find(el=>el.jaql.column == columnName)
	filterjaql = {
					to: dashdatefilter.jaql.filter.members[dashdatefilter.jaql.filter.members.length - 1],
					custom: true
	}
	
	widgetdatefilter = ev.query.metadata.find(el=>el.panel && el.panel == 'scope' && el.jaql.column == columnName)
	widgetdatefilter.jaql.filter = filterjaql

})

-Hari

 

TJT
7 - Data Storage
7 - Data Storage

Is it possible to achive same functionality with date range.

As in,respective widget (indicator) show aggregated value till end date in date range ignoring the start date part.