COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: tushar gaurav on 18 Apr 2023 07:18:36 AM

Title: Need javascript for auto submission of Value prompt in Prompt page
Post by: tushar gaurav on 18 Apr 2023 07:18:36 AM
Hi,

I have single select value prompt in my prompt page which contain only one value i.e. current date.
I want the value prompt to be auto submitted and report page should be generated directly without showing prompt page.
Can we achieve this scenario with the help of javascript. If yes then can you please suggest me the same.

**I am executing the report after disabling the interactive mode.


Thank and Regards,
Tushar Gaurav
Title: Re: Need javascript for auto submission of Value prompt in Prompt page
Post by: dougp on 18 Apr 2023 01:16:00 PM
QuoteI am executing the report after disabling the interactive mode.

What does that mean?  Are you saying you are always running the report from the editor?  Or are you saying the report is saved using Run with full interactivity = No
What use case is driving you to use this setting?
Title: Re: Need javascript for auto submission of Value prompt in Prompt page
Post by: tushar gaurav on 19 Apr 2023 02:14:33 AM
Hi Doug,

Thanks a lot for your response.
Yes I am using " Run with full interactivity = No" as I have used various javascripts in my report.
Actually I am using date prompts in my report where I need to show last 4 weeks data.
I have 2 date prompts one each for start date and end date.
I am using the following condition:
--------------------------
[C].[C_Gosales_DM].[page].[Order_date]
>=
_add_days(#prompt ('StartDate', 'date', timestampMask (_add_days ($current_timestamp, -28), 'yyyy-mm-dd'))#,0)
and [C].[C_Gosales_DM].[page].[Order_date] <
_add_days(#prompt ('EndDate', 'date', timestampMask ($current_timestamp, 'yyyy-mm-dd'))#,1)
------------------------
However when I am exceuting the report ,both Start date and End date are showing Current date by default which is giving wrong impression as the start is actually having date of 4 week earlier.
In order to overcome this challenge , I have planned to create a prompt page ,where I should have a value prompt having only one value i.e date of 28 days back of current date and I need javascript to achieve the same.
It will be really helpful if you can guide me.

Thanks and Regards,
Tushar Gaurav
Title: Re: Need javascript for auto submission of Value prompt in Prompt page
Post by: dougp on 19 Apr 2023 01:47:17 PM
Good luck finding someone willing to spend time developing JavaScript code for Cognos 10.
Title: Re: Need javascript for auto submission of Value prompt in Prompt page
Post by: cognostechie on 19 Apr 2023 03:07:35 PM
What's the need of Javascript for this? A value prompt allows to put a code in there as a filter. You can write the code as:

[date] = _add_days(current_date, -28) and create a filter in the query of the value prompt.