If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

set default Date Prompt in Report Studio

Started by elee123, 11 Nov 2014 07:58:10 AM

Previous topic - Next topic

elee123

Hi Everyone,

How can I set the Date Prompt default to yesterday's date instead of today?

kc9400

#1
If you place a HTML item to the right of your date prompt and insert the following:


<script language="javascript">
var dDate = new Date();
//Subtract one day
dDate.setDate(dDate.getDate()-1);
pickerControlName.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>



You'll have to set the "Name" of the date prompt to match what is put in the JS, I've placed the relevant part in BOLD. The name of the date prompt must match what you call it here.

Source: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014441492
When life gives you lemons, throw them at someone.

elee123


jabs

Mine wasn't working, so I went to the referenced link. One step was skipped, unless I misread something. Once I did the following, the JS script worked.

Add name to "Name" attribute of the date prompt.

inu

Quote from: kc9400 on 11 Nov 2014 08:59:36 AM
If you place a HTML item to the right of your date prompt and insert the following:


<script language="javascript">
var dDate = new Date();
//Subtract one day
dDate.setDate(dDate.getDate()-1);
pickerControlName.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>



You'll have to set the "Name" of the date prompt to match what is put in the JS, I've placed the relevant part in BOLD. The name of the date prompt must match what you call it here.

Source: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014441492




Hi Team,

I used same js code, and set the name of Date prompt to the code. still not working ... can you please tell me , why not working....


inu

Quote from: kc9400 on 11 Nov 2014 08:59:36 AM
If you place a HTML item to the right of your date prompt and insert the following:


<script language="javascript">
var dDate = new Date();
//Subtract one day
dDate.setDate(dDate.getDate()-1);
pickerControlName.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>



You'll have to set the "Name" of the date prompt to match what is put in the JS, I've placed the relevant part in BOLD. The name of the date prompt must match what you call it here.

Source: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014441492


See the attached file,, and let me know, where i am missing..

js code is as follows , i used

<script language="javascript">
var dDate = new Date();
//Subtract one day
dDate.setDate(dDate.getDate()-1);
pickerControlDate_P.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>


I appreciate your response


Thanks
Inam

cognos3

Hi Inu,

Were you able to solve the problem? I also need to set Yesterday as default in date prompt.

Thanks!! in advance

kc9400

Quote from: cognos3 on 28 Apr 2017 10:15:42 AM
Hi Inu,

Were you able to solve the problem? I also need to set Yesterday as default in date prompt.

Thanks!! in advance

Did you manage to get it working?
When life gives you lemons, throw them at someone.