COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: COGNOSBC on 15 Jul 2013 02:42:36 PM

Title: param display
Post by: COGNOSBC on 15 Jul 2013 02:42:36 PM
in param display value how to display date format from : 2013-07-14   to  jul 14, 2013
Title: Re: param display
Post by: MMcBride on 15 Jul 2013 03:28:49 PM
What type of a prompt are you using to select the date?

I found if I used a Date Prompt - I could not figure out how to modify the format of the Paramdisplay

However if I used a Drop Down list to show the dates and select from the list, by changing the Format on the Prompt Object it will change the format of the Param display value.

Title: Re: param display
Post by: HalfBloodPrince on 16 Jul 2013 11:53:53 PM
Try this

add a layout calculation in report page, add ParamDisplayValue('Parameter1').

then set format of layout calculation as date.

set following properties
1)date style - medium
2)Display month - short name
Title: Re: param display
Post by: MMcBride on 18 Jul 2013 12:56:38 PM
HalfBloodPrince
I tried this and got the same results, I am on 10.1.1 fp2 so perhaps the issue is version.

If I use a Date Prompt - I can find no way to modify the display
If I use a List prompt with the date based data item and apply the format to the prompt I can make it look however I want.
Title: Re: param display
Post by: CognosPaul on 18 Jul 2013 01:00:21 PM
ParamDisplayValue always return string values.

Try the following:
date2timestamp(string2date(ParamDisplayValue('Parameter1')))

The data format will work on the timestamp data type without an issue.
Title: Re: param display
Post by: MMcBride on 18 Jul 2013 03:13:49 PM
No change
I am including a very simple Report Spec that has a prompt page with 2 prompts
One is Date Prompt (Parameter1)
The Second is a Value Prompt (Parameter2)

To populate Parameter2 I connected to a Relational Package with Date in it. This is a DB2 filed with a Data Type of "Date" defined in the model. You can substitute this for any date you have in any package - I don't have the sample packages from IBM loaded atm or I would have used a Date from there.

On the Report Page I have 6 Report Expressions
3 based on the Date Prompt and 3 based on the Value Prompt

1 - date2timestamp(string2date(ParamDisplayValue('Parameter1')))
No errors on this but it only displays --
2 - string2date(ParamDisplayValue('Parameter1'))
Thinking that since this wasn't a Date/Time stamp I changed your logic to just use a string to date comparison once again it only displays --
3 - ParamDisplayValue('Parameter1')
Just to see what it would display - "Jul 18, 2013"

Second set of three use the same logic as above except with the Paramter2
1 - date2timestamp(string2date(ParamDisplayValue('Parameter2')))
--
2 - string2date(ParamDisplayValue('Parameter2'))
--
3 - ParamDisplayValue('Parameter2')
For this one I went back to the Value Prompt itself since changing the format here doesn't seem to do anything and made the Data Type for the Value Prompt to be "Date" and selected "Date Style = Full" I got "Wednesday, July 17, 2013"
I should point out the reason it is the 17th is that is the ONLY day in Date field (it is a single day snapshot)
     
So I was able to modify my Date display with a value prompt but not with a Date Prompt parameter.

Great suggestions all, but using a Date Prompt I am unable to get the displayvalue to give me anything I can modify.

This may be one of those times where I am seriously over thinking this... but I have tried everything I can to no avail.
Title: Re: param display
Post by: CognosPaul on 18 Jul 2013 04:47:55 PM
Try using ParamValue instead of ParamDisplayValue
Title: Re: param display
Post by: MMcBride on 22 Jul 2013 10:32:03 AM
And as easy as that...

Paramvalue() allowed me to modify the Date formate for the 1, 2 and 3 in my sample report without any problems

Thanks PaulM  ;D guess I was too hung up on the paramdisplayvalue()  :-[