cancel
Showing results for 
Search instead for 
Did you mean: 

Create a widget filter based on dashboard filter

Akhila
7 - Data Storage
7 - Data Storage

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?

2 REPLIES 2

harikm007
12 - Data Integration
12 - Data Integration

@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