COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: katdbc on 18 Mar 2011 12:54:19 PM

Title: convert date to string!!
Post by: katdbc on 18 Mar 2011 12:54:19 PM
Can you please help me correct this statement!!

Cast (([Report View].[Eye Charts].[YEAR] -1) ,varchar)

with this i have to conacatenate a text value
Title: Re: convert date to string!!
Post by: Lynn on 18 Mar 2011 01:24:42 PM
Assuming the [YEAR] data item contains something like 2011 to represent a year, and is a numeric field (therefore worthy of subtraction), I'd suggest the following:


Cast ( ([Report View].[Eye Charts].[YEAR] -1) , VARCHAR(4) )


To concatenate:


Cast ( ([Report View].[Eye Charts].[YEAR] -1) , VARCHAR(4) ) + ' was a very good year'