COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: shwethagp on 27 Oct 2011 02:27:05 PM

Title: Covertion from Character dataype to Measure
Post by: shwethagp on 27 Oct 2011 02:27:05 PM
I have to convert a measure which is loaded from SSIS to Cognos as a character data type.

I tried using cast() function. It did not work, may be because there are some NULL values in the column.

Can any one please help.
Title: Re: Covertion from Character dataype to Measure
Post by: blom0344 on 28 Oct 2011 03:08:39 AM
wrap a coalesce function around the measure prior to casting: coalesce([measure],'0') Better check first whether nulls are present. This approach will not work for empty string values
Title: Re: Covertion from Character dataype to Measure
Post by: cognostechie on 28 Oct 2011 11:37:47 AM
Quote from: shwethagp on 27 Oct 2011 02:27:05 PM
I have to convert a measure which is loaded from SSIS to Cognos as a character data type.

I tried using cast() function. It did not work, may be because there are some NULL values in the column.

Can any one please help.

Since the DB is SQL server, Use the 'replace' function to replace null values to a character string as '0' (zero) then use the cast function around it.

You can also try -

1> Create a calculated column with this expression :
     
       If ([Date Item]) is null then ('0') else ([Data Item]).

2> Create another calculated column and cast the above data item to integer/decimal