COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tommeyers on 06 Mar 2017 03:53:28 PM

Title: Javascript in a Job 10.2 API
Post by: tommeyers on 06 Mar 2017 03:53:28 PM
I have a javascript on my parameter page that sets a fromdate prompt and todate prompt as the value changes in a drop down (lastmonth, ytd, today, ...); it works well except when I want to use it in a job.

The two date prompts are mandatory so I can't use logic in the report to choose them.   When the report runs the date values need to be set need to be set.

I want to choose the dropdown value in the job and have the two date values set when the report queries run.

Currently I am changing the from and to dates every month. OK, but time consuming and errors are easy.

I do not have access to the FM model. (eClinical is the package).

I am stuck, Tom Meyers
Title: Re: Javascript in a Job 10.2 API
Post by: rockytopmark on 07 Mar 2017 03:21:45 PM
Have you considered using prompt macros?  You don't indicate how your parameters are being used in the report.... filters?  MUNs?

If you have a simple detail filter such as:  [someQS].[someDateItem] = ?fromDate?

Change it to use the prompt macro... something along the lines of:

[someQuerySubject].[someDateItem] = #prompt('fromDate','date',<some code (similar to whats in your javascript) that returns the default date>)#

For example... #prompt('fromDate','date',_first_of_month ($current_timestamp))# returns the 1st of the current month.
Title: Re: Javascript in a Job 10.2 API
Post by: tommeyers on 09 Mar 2017 08:15:45 AM
Thank you for this idea.  I will try that and report back.

Tom