COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: actcognosuser on 26 Feb 2010 01:33:28 PM

Title: Help with date format!
Post by: actcognosuser on 26 Feb 2010 01:33:28 PM
I have a date in my crosstab.When I change the format to show only months,
nothing is changing in my report.The format is PDF.The date still appears with default format.
Title: Re: Help with date format!
Post by: Nuffsaid on 26 Feb 2010 02:58:37 PM
Hi,

In your crosstab row or column select your date field, then in the Properties section change the "Text Source - Source Type" from Member Caption to Data Item Value. You should then be able to format however you wish.


Nuffsaid.
Title: Re: Help with date format!
Post by: actcognosuser on 26 Feb 2010 03:23:53 PM
I changed the source type to Data item value.It did not change.It still shows the default format.
I am applying some rules to render the column date.

Report  displays  dates for month until march of 2010 ,for last years date the column name will be previous year.Is it because of this if then condition that my formatting is not applied.
Title: Re: Help with date format!
Post by: Nuffsaid on 26 Feb 2010 03:55:01 PM
Hi,

Based on the info provided in your first post I thought you were just having difficulty formatting a date field.

QuoteI am applying some rules to render the column date

What rules would these be ??

QuoteIs it because of this if then condition that my formatting is not applied.

More than likely, but we would need to know what the condition is in order to offer up any help.


Nuffsaid.
Title: Re: Help with date format!
Post by: jon on 01 Mar 2010 02:52:07 PM
Quote from: actcognosuser on 26 Feb 2010 03:23:53 PM
I changed the source type to Data item value.It did not change.It still shows the default format.
I am applying some rules to render the column date.

Report  displays  dates for month until march of 2010 ,for last years date the column name will be previous year.Is it because of this if then condition that my formatting is not applied.

After you change it to Data Item Value, go to Data Format, change it to date and set the date style in properties. It'll work.
Title: Re: Help with date format!
Post by: actcognosuser on 02 Mar 2010 07:50:36 AM
Hi Nuff,
              My rule is if date = maximum(date) then 'Current' else (date)

How do I apply formatting to display only the month for my date filed.

Thanks in advance!
Title: Re: Help with date format!
Post by: Nuffsaid on 02 Mar 2010 10:10:44 AM
Hi,

First off, if "Date" is a true date/time field you're mixing data types in your IF statement. This is a no no........

Thinking this solution will be database specific. This works with Oracle however;

if([Date]=maximum([Date]for report))
then('Current')
else (to_char([Date],'MON'))


Nuffsaid.

Title: Re: Help with date format!
Post by: actcognosuser on 02 Mar 2010 10:37:14 AM
Hi Nuff,
              I did use char(date).How do I get it to display month for the date?
Title: Re: Help with date format!
Post by: Nuffsaid on 02 Mar 2010 11:09:27 AM
Hey,

to_char([Date],'MON') will display the abbreviated month.

Google the function if you're still unsure....


Nuffsaid.