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

Default Date parameter

Started by cognosrebel, 21 Apr 2006 12:56:05 PM

Previous topic - Next topic

cognosrebel

Hi all,

I need to set the default date for a date prompt as "System Date -1 (It has to show April 20th Ã, when it is April 21st)"when the report was run.

So how do i set default value dynamically ?

I got some Java script from ITtoolbox which apparently do this...but could not get it working.

>>1.Add a date prompt with prompt name as pardatefrom
>>2.Next to finish button in the bottom of your prompt page drop a HTML item.
>>3.Within the HTML tag paste the code provided below


<script>

var cntlName;

function right(str, n){

Ã,  Ã, if (n <= 0)

Ã,  Ã,  Ã,  return "";

Ã,  Ã, else if (n > String(str).length)

Ã,  Ã,  Ã,  return str;

Ã,  Ã, else {

Ã,  Ã,  Ã,  var iLen = String(str).length;

Ã,  Ã,  Ã,  return String(str).substring(iLen, iLen - n);

Ã,  Ã, }

}

function customCheckPage(){

var par1;

var par2;

for( var i=0; i<preProcessControlArray.length; i++){

Ã, cntlName = eval(preProcessControlArray);

Ã, if ( cntlName.m_oSubmit.name.toLowerCase() Ã, 'p_pardatefrom' ){

Ã,  Ã, eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');

Ã,  Ã, par1 = cntlName.m_oForm.value;

Ã, } Ã, 

}

Ã,  Ã,  Ã, 

}

for( var i=0; i<preProcessControlArray.length; i++){

Ã, cntlName = eval(preProcessControlArray);

Ã, dt = new Date();

Ã, df = new Date( dt - 1*86400000);

Ã, if (cntlName.m_oSubmit.name.toLowerCase() Ã, 'p_pardatefrom' ){

Ã,  Ã, cntlName.m_oEditBox.value = df.getFullYear()

Ã,  Ã,  Ã,  Ã,  + '-' + right('0'+(1+df.getMonth()),2)

Ã,  Ã,  Ã,  Ã,  + '-' + right('0'+1,2);

Ã,  Ã, eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');

Ã, }

}

</script>

BIsrik

check out the 'p_pardatefrom'  part. The parameter should look like ?pardatefrom? ..

Srik

anoop_ind2

The statement seems to miss the operator....

  if (cntlName.m_oSubmit.name.toLowerCase() == 'p_parDateFrom' )