COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: manias on 22 Jan 2015 11:17:38 AM

Title: (RESOLVED) Using javascript in job (prompt page)
Post by: manias on 22 Jan 2015 11:17:38 AM
Dear all,

I have a report with date prompt from SAP BW. In prompt page i set the default value using javascript (http://www.ibm.com/developerworks/library/ba-pp-reporting-scripting_techniques-page634/index.html). It works great when i'm run a report from Cognos Connection.

<script type="text/javascript">
var fdf = getFormWarpRequest();
var listDateFrom = fdf.txtDatePDateFrom
var ftp = getFormWarpRequest();
function last90Days()
{
var ndays = 90;
var dtToday = new Date();
var dtlast90Days = new Date (dtToday - (86400000*(ndays)));
var strlast90Days = [dtlast90Days.getUTCFullYear(), dtlast90Days.getMonth()+1,
  dtlast90Days.getDate()].join("-");
return strlast90Days;
}
pickerControlPDateFrom.setValue(last90Days() );
</script>


And now i want to schedule report using job with saving default value which are set using javascript. When i click "Override the default values" and try to set the velue for calendar prompt, i see as default value is today (22.01.2015) not value that i set using javascript.

When run the job without setting default values, calendar prompt also has the current date.

Is it Possible to save value that set using javascript?

Thanks. Egor.
Title: Re: Using javascript in job (prompt page)
Post by: manias on 23 Jan 2015 05:01:43 AM
Maybe anyone knows about using javascript in 'Jobs'?
Title: Re: Using javascript in job (prompt page)
Post by: manias on 26 Jan 2015 12:05:58 AM
I found a solution here http://cognospaul.com/2011/07/12/javascript-stopped-working-in-cognos-portal/,
Thanks, to Paul!!
Title: Re: (RESOLVED) Using javascript in job (prompt page)
Post by: Eiffel_act on 10 Sep 2015 12:38:57 PM
Hello - i am an amature developer trying my hands on Java script in Cognos. Can you send me the solution for this issue. I am trying this code and after i select the dates and run the report, the report does show me the data for the selected dates but the values in the prompt come back to the current date minus 90 and does not remain the same what i selected.