COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: esanray on 15 Nov 2011 08:19:25 PM

Title: QE-DEF-0405 & QE-DEF-0260
Post by: esanray on 15 Nov 2011 08:19:25 PM

Please find bellow the Query

case when[GSM].[No_PAC] <>[GSM].[NO_IN_COM] then count ( distinct[GSM].[TRAIN_NO] ) else 'ok'
end

This Query give the following error.

QE-DEF-0405 Incompatible data types in case statement.

then i write the query with if condition

if ([GSM].[No_PAC] = [GSM].[NO_IN_COM] then 'ok' else count ( distinct[GSM].[TRAIN_NO] )


then it display
QE-DEF-0260 Parsing error before or near position

Please check the quey and correct




i need the report to display like this


10.00      5
11.00      4
12.00      ok
13.00      2
14.00      ok


Title: Re: QE-DEF-0405 & QE-DEF-0260
Post by: HalfBloodPrince on 15 Nov 2011 11:08:52 PM
Try this
if ([GSM].[No_PAC] = [GSM].[NO_IN_COM] )
then ('ok')
else
(cast(count ( distinct[GSM].[TRAIN_NO] ),varchar(5)) )
Title: Re: QE-DEF-0405 & QE-DEF-0260
Post by: blom0344 on 16 Nov 2011 12:53:01 AM
No that will not work.. Either true/false the outcome must be the same datatype..

case when[GSM].[No_PAC] <>[GSM].[NO_IN_COM] then count ( distinct[GSM].[TRAIN_NO] ) else (0) end