COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: davidcognos on 29 Aug 2010 07:47:27 AM

Title: Format the date prompt into DD/MM/YYYY when data is not present and display
Post by: davidcognos on 29 Aug 2010 07:47:27 AM
Hi,

I have a requirement in report, When the user selects the date prompt and if data is not present in the database we have to display the date format in page header as DD/MM/YYYY. The database is DB2. I have tried with the options of data format, extract, substring... But i am unable to achieve this.

When data is present, the format displays as DD/MM/YYYY, as I have applied the data format for the dataitem (?data?).

I Have tried with the calculation
[(rtrim(cast_char (extract ( day ,?date?)))+ '/' +  rtrim(cast_char (extract ( month ,?date?))) + '/' + rtrim(cast_char (extract ( year ,?date?) ))) ]


How can I display the date format as DD/MM/YYYY to the date prompt displayed in report when data is not present.

Please provide me the solution for this.

Thanks in Advance!!!


Title: Re: Format the date prompt into DD/MM/YYYY when data is not present and display
Post by: Gopinath on 30 Aug 2010 07:15:22 AM
If your query returns empty result set then, the prompt value will not be displayed as it is also a part of the query. Try using layout calculation instead.
Title: Re: Format the date prompt into DD/MM/YYYY when data is not present and display
Post by: davidcognos on 30 Aug 2010 10:07:46 AM
Hi,

I have tried with the layout calculation , but not able to achieve this format.

Any suggestion.......


Regards
Title: Re: Format the date prompt into DD/MM/YYYY when data is not present and display
Post by: Gopinath on 30 Aug 2010 11:13:43 AM
Can you try ParamValue() instead of ParamDisplayValue()
Title: Re: Format the date prompt into DD/MM/YYYY when data is not present and display
Post by: jive on 30 Aug 2010 02:23:56 PM
Hi,
If you used the date to sort later by date you can define a date like 01/01/1850 when the value return is null. That you will always have a value. You can also used an equivalent of what we have in Oracle a function like NVL it's in conjunction with null value. When the value return is null the function replace the null with a text saying "no date define" and in the prompt return all date in character in the format you need.
I hope my solution is clear Englisher is not my first language.

Thanks