The CreatorCon Call for Content is officially open! Get started here.

How to set default value on Custom date filter by using macros

Sai Rakesh2
Tera Contributor

I'm using Custom date filter through macros on Dashboard. Now I want set default value as "Yesterday" on Custom date filter. How to set the default value..? Can anyone help me on this? Thanks in Advance..

4 REPLIES 4

JamesLindsay
Giga Guru

Same, anybody?

See my general reply to this post.

 

JamesLindsay
Giga Guru

The simple fix for me this was to go ahead and apply a date filter in the report. This way when the dashboard renders it uses that filter on initial load. So, I just used opened = today to limit the amount of data pulled on load. It was pulling all the incident records, now it just pulls today, and I can adjust the interactive filter with no issues.

Michael Gedzelm
Tera Contributor

 I had this exact same issue and was able to fix it by adding two lines to the UI Macro.

 

1) Open your UI Macro, which in my case was a copy of interactive_date_filter_norsk.

2) Search on the following line (which in my case was at line 816): 

        var fromSelectBox = $j("#" + uuid + " .fromSelect");
3) After the line found in step 2 above, insert the following two lines:        fromSelectBox.val("Yesterday@javascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(1)");
setTimeout(handleChangeSelection,100);
4) Save the UI Macro, and then refresh your dashboard page.   The "Select Date" box should now default to "Yesterday".