Hi all,
Cognos version : 8.2
I need to build JavaScript function that gets "start time" and "time interval" from Prompt page and returns an End Time parameter
Snap shot from the prompt page:
(http://s13.postimg.org/4bc9bhwyb/cog.jpg) (http://postimg.org/image/4bc9bhwyb/)
for example :
If i choose start time 7-10-13 00:00 and time resolution Hour , i want to get End time = 7-10-13 01:00 and so on for the daily and Weekly options...
I also need the function to return this value in format that can be use in the Report pages
Thanks In Advance
Shachar
Hi Shachar,
I thought you already had a standardized suite of functions for 8.2 set up. None of my existing clients have 8.2 installed and since the JS api changed drastically since then I have no way of building it.
Give me a call tomorrow afternoon. Once we get it, I'll post the solution here.
So Thanks to CognosPaul we found asolution:
QuoteTableKey_Box=document.formWarpRequest._oLstChoices_key;
TableKey_Box[0].text='Select Time Resolution';
TableKey_Box[2].selected=true;
TableKey_Box.onclick=function(){
// Get start date and time and convert to JS Date.
var sD = window['pickerControlBeginDate'].m_oForm.value.split('-');
// subtract 1 from month (0 is January, 11 is December)
sD[1]-=1;
var sT = window['timePickerBeginDate'].m_oForm.value.split(':');
var sDT = new Date(sD[0],sD[1],sD[2],sT[0],sT[1]);
if(this.value==='h') {sDT.setTime(sDT.getTime()+3600000);}
else if(this.value==='d') {sDT.setDate(sDT.getDate()+1);}
else if(this.value==='w') {sDT.setDate(sDT.getDate()+7);}
window['pickerControlEndDate'].setValue(sDT.getFullYear()+'-'+(sDT.getMonth()+1)+'-'+sDT.getDate());
window['timePickerEndDate'].setValue(sDT.getHours()+':'+sDT.getMinutes()+':'+sDT.getSeconds()+'.'+sDT.getMilliseconds());
it's versy important to put full date (year,month,day) at the pickerControl and full time (hour,minutes,seconds,millisecinds) at the timePicker. Otherwise, it just won't work