COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Phil Scottow on 19 Mar 2013 09:42:19 AM

Title: Custom Header in a crosstab
Post by: Phil Scottow on 19 Mar 2013 09:42:19 AM
Report Studio V10.1
I am trying to make a columns header in a crosstab dynamic.
So far. If I click on the column header and change text source > source Type from 'Member Caption' to 'Report expression' and do a simple Report Expression Today() all works well.
but when I try to extend this Report expression to _first_of_month (Today ())
I just get a CRX-API-0014
An invalid function argument type was found at or near the position '24' in the expression "_first_of_month (Today ()) ".

there must be a simple way around this. Can anyone advise me
Thanks
Title: Re: Custom Header in a crosstab
Post by: Phil Scottow on 20 Mar 2013 04:53:45 AM
Well this is what I came up with. and it works. change the add months value as required.

case substring(timestamp2string (_add_months (_first_of_month (date2timestamp (Today ())),-12)),6,2)
when '01' then 'JAN'
when '02' then 'FEB'
when '03' then 'MAR'
when '04' then 'APR'
when '05' then 'MAY'
when '06' then 'JUN'
when '07' then 'JUL'
when '08' then 'AUG'
when '09' then 'SEP'
when '10' then 'OCT'
when '11' then 'NOV'
when '12' then 'DEC'
end
+' '+substring (timestamp2string (_add_months (_first_of_month (date2timestamp (Today ())),-12)),1,4)