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

Cognos 8.3 Javascript to compare dates

Started by BIsrik, 01 Nov 2008 09:18:02 AM

Previous topic - Next topic

BIsrik

Hi,

I am trying to rewrite the javascript for comparing the from and to dates. This is the script written for it...
"
<!--owner-drawned button for prompting-->
<button type="button" name="finishChkFormat" id="finishChkFormat" class="clsPromptButton"
style="font-family:Arial;font-size:10pt;font-weight :bold;width:2cm"
onmouseover="this.className = 'clsPromptButtonOver'"
onmouseout="this.className = 'clsPromptButton'"
onClick="ChkFormat()">Finish</button>

<!--button's event-->
<script text=javascript>
var cntlName;
function ChkFormat()
{
var par1 = "";
var par2 = "";
for( var i=0; i<oCVRS.preProcessControlArray.length; i++){
  cntlName = eval(oCVRS.preProcessControlArray);
  if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_pardatefrom' ){
//eval(pickerControlPDate + cntlName.m_sRef + pickerControlPDate.lostFocus());
par1 = pickerControlPDate.m_oForm.value;
  }   
  if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_pardateto' ){
    par2 = pickerControlPDateTo.m_oForm.value;
  }
}
alert(par1);
alert(par2);
  if (par1<=par2)
    oCVRS.promptAction('finish');
  else
    alert('FROM DATE parameter must be smaller than or equal to TO DATE parameter!');
}
</script>

<!--insertion of button-->
<script xmlns:xIE5="http://developer.cognos.com/prompting/x IE5">
var promptButtonfinishCheckFormat = new CPromptButton (document.getElementById("finishChkFormat"),PROMPTBUTTON_FINISH, true, "RS");
oCVRS.pageNavigationObserverArray = oCVRS.pageNavigationObserverArray.concat('promptButtonfinishCheckFormat');
oCVRS.notify();
</script>
"

The script works fine for the first time. When i click submit for first time and re-execute the same report from the cognos viewer the script doesn't work.

After a bit of debugging, i found that the 'pickerControl<promptname>.m_oForm.value' is not showing the selected value.

Please help me in fixing this issue. If you have any script for the same in Cognos 8.3 please do share with me.

Regards,
Srik