COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: tushar gaurav on 28 Dec 2021 02:30:16 AM

Title: How to give current date as default selection in date prompt
Post by: tushar gaurav on 28 Dec 2021 02:30:16 AM
Hi,

In my report there is no prompt page and there is a date prompt in the report page itself along with a list report.
I need to give "last date of the previous month" as default selection in the date prompt and when I execute the report the list report should show the data as per "last date of the previous month".
I have javascript to show "last date of the previous month" , but its working when the date prompt is in prompt page.
When I add the date prompt in the report page and execute the report , I am getting Date popup asking for date selection.
Can you please help me.

Thanks,
Tushar
Title: Re: How to give current date as default selection in date prompt
Post by: dougp on 28 Dec 2021 10:20:18 AM
Make the filter/parameter optional:

#prompt ('MyDateParameter', 'date', timestampMask (_last_of_month (_add_months ($current_timestamp, -1)), 'yyyy-mm-dd'))#
Title: Re: How to give current date as default selection in date prompt
Post by: tushar gaurav on 29 Dec 2021 12:34:58 AM

Hi Doug,

Thanks a lot for your help  :)