COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Cognos Connection, Viewer, Scheduler => Topic started by: yoniw on 09 Dec 2013 08:48:51 AM

Title: Schedule reports who use Javascript
Post by: yoniw on 09 Dec 2013 08:48:51 AM
Hello everyone,
I am using Cognos 10.2.1 fixpack 1, linux environment, Vertica /Oracle.
We have a problem - most of our reports run using javascript elements (to set time for example) in prompts.
we have a Drop down list with list of last 1 hour, last 2 hours etc. the selection in the report triggers a javascript function to change the begin and end time in the prompt page.

when we schedule a report to run on "last 1 hour" - because there is no "browser", the Javascript is not working and the dates remain the old dates...

Do you know how to enable the Javascript?

BR
Yoni
Title: Re: Schedule reports who use Javascript
Post by: navissar on 10 Dec 2013 07:26:56 AM
Hey Yoniw,
JavaScript is a run-time scripting language. This means that in order for JavaScript to work, it needs to be read and interpreted by a web browser. Before it does, it's just a bunch of letters.
Now, a scheduled report doesn't run the HTML for the prompt page, so it doesn't call on your JavaScript, therefore your JS doesn't exist as far as it is concerned.
However, not all is lost: The type of logic you're describing is easy to set up without any scripts: simply set up a filter with a condition that takes the selected prompt value and translates it to a desired date. For instance:
(?dateSelectionPrm?='today' AND [Date]=current_date)
OR
(?dateSelectionPrm?='yesterday all my troubles seemed so far away' AND [Date]=_add_days(current_date,-1))

You can make this prompt optional, so it doesn't mess up your current set up.
Title: Re: Schedule reports who use Javascript
Post by: yoniw on 10 Dec 2013 09:14:03 AM
I was afraid of that...:(
I thought maybe there is another way...

Thanks Nimrod (Toda).
Yoni
Title: Re: Schedule reports who use Javascript
Post by: navissar on 10 Dec 2013 02:10:58 PM
Hey Yoni,
If you're not keen on changing your reports, you could probably use Event Studio to populate the prompts based on the relevant logic.
Behatzlaha!