Home Knowledge Articles IBM Cognos 10 How to change default prompt behaviour in a report
Follow us on Twitter


Countries

50.1%United States United States
7.6%India India
7%United Kingdom United Kingdom
5.1%Australia Australia
4.8%Canada Canada

Visitors

Today: 37
Yesterday: 573
This Week: 37
Last Week: 3348
This Month: 9422
Last Month: 15365
Total: 383509


How to change default prompt behaviour in a report Print E-mail
(3 votes, average 3.67 out of 5)
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)
prompt1

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.

prompt2
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)
prompt3
4. The result will be as below :

prompt4

www.cogknowhow.com

 

Comments

avatar CognosGirl
0
 
 
Hi Varun,

can you please post here the code (from notepad) you use in your article above?

thanks!
avatar Varun Tiwari
0
 
 
Hi CognosGirl,

The code is same as the code written in screesnhot for step number 3.

Hope that helps.

Thanks,
Varun
avatar Varun Tiwari
0
 
 
Hi CognosGirl,

The code is same as the code written in screesnhot for step number 3.

Hope that helps.

Thanks,
Varun
avatar Varun Tiwari
+1
 
 


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() );

Please login to post comments or replies.
 
 

Login

For more content en features!



CogKnowHow Newsletter

Season's Greetings


Receive HTML?

Polls

How many users are working on your Cognos environment?