COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: inu on 25 Sep 2017 12:36:44 PM

Title: Javascript function should be applied only on default run
Post by: inu on 25 Sep 2017 12:36:44 PM
Hi,

I created a date prompt and used javascript function to set the default set, it works fine. When we change the date and click the Finish button date is applied to the filter perfectly,  but same default date is set again in the date prompt.
I know the reason because whenever we click the finish button whole page is refreshed and date prompt also set as default date.
e-g i set default date as 20-jun-2017 it displays when we run the report first time, that's fine for me. On further if i select another date say 30-Sept-2017 and click the Finish button, in query filter it is applied correctly as 30-Sept-2017, but in the date prompt  20-jun-2017 displays.
that's the issue.
Default date should display only once when we run the report, and on proceeding date prompt should display as per user selection.
Please put some light on it and share the idea.


Thanks.
Inma
Title: Re: Javascript function should be applied only on default run
Post by: rockytopmark on 05 Oct 2017 11:49:03 AM
Put a render variable on the Javascript HTML Item, so it only "Renders" when the parameter is not set
Title: Re: Javascript function should be applied only on default run [RESOLVED ]
Post by: inu on 06 Oct 2017 11:43:24 PM
Quote from: rockytopmark on 05 Oct 2017 11:49:03 AM
Put a render variable on the Javascript HTML Item, so it only "Renders" when the parameter is not set
I found the solution, in the same js code Add onions property under body tag. 
Title: Re: Javascript function should be applied only on default run
Post by: Blue on 09 Oct 2017 04:55:22 PM
I don't like the "add onions" property - too smelly!
Title: Re: Javascript function should be applied only on default run
Post by: inu on 31 Oct 2017 11:09:18 AM
Quote from: Blue on 09 Oct 2017 04:55:22 PM
I don't like the "add onions" property - too smelly!
Typing mistake... Onload property
Title: Re: Javascript function should be applied only on default run
Post by: rockytopmark on 17 Nov 2017 01:37:08 PM
if the user selected to re-prompt (re-loading the prompt page), wouldn't that trigger the OnLoad() again essentially replacing the user's selection with the default one again?