|
How to change default prompt behaviour in a report |
|
|
|
Written by Varun Tiwari
|
|
Monday, 21 November 2011 20:26 |
|
By default the date prompt shows the current date in the prompt. So , if you want to run an MTD report or if you want to customize the default date in the prompt as per your requirements.
This document will help you achieve the same. Solution:
1. Drag a Date & Time prompt in your report and give it any name of your choice(e.g. refer below screenshot, I have given Date1)

2. Drag a HTML item on right side of the prompt (refer below). Please note that we are only concentrating on From Date(Prompt name Date1 as given in point 1) and the other prompt will have default current date.
 3. Paste the script( attached in notepad) in the HTML item where Date1(in green below) is the name of the prompt as in point 1)
 4. The result will be as below :

www.cogknowhow.com
|
Comments
can you please post here the code (from notepad) you use in your article above?
thanks!
The code is same as the code written in screesnhot for step number 3.
Hope that helps.
Thanks,
Varun
The code is same as the code written in screesnhot for step number 3.
Hope that helps.
Thanks,
Varun
function SetFirstDay ()
{
var dtToday = new Date();
var FirstDay = new Date(dtToday.getFullYear(), dtToday.getMonth(), 1);
// NOTE var FirstDay is to set the first date of current month using current date in dtToday variable.
var strFirstDay = [FirstDay.getUTCFullYear(), FirstDay.getMonth()+1, FirstDay.getDate()].join("-");
return strFirstDay ;
}
function SetTime ()
{
var Time = "09:00:00.000" ;
return Time;
}
pickerControlDate1.setValue( SetFirstDay() );
timePickerDate1.setValue( SetTime() );