Ashish B Sathish
Ashish B Sathish

Reputation: 121

CONTAINS inside CASE statement in COGNOS

I am trying to implement a nested CASE in Cognos. Here is my code,

case 

when ?Radio Button for selection? = 'Y' 
then (substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 7))

when ?Radio Button for selection? = 'M' 
then (substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3))

when ?Radio Button for selection? = 'Q' and substring(cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('01', '02', '03') then 'Q1'

when  ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('04', '05', '06') then 'Q2'

when  ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('07', '08', '09') then 'Q3'

when  ?Radio Button for selection? = 'Q' and substring( cast ([TN_Base_Views].[TktCoupon].[CouponStatusChangeDate], VARCHAR(10) ), 1, 3) contains ('10', '11', '12') then 'Q4' 

end

I am getting a parsing error on Validating the code. Please help me.

Upvotes: 0

Views: 2740

Answers (1)

Ashish B Sathish
Ashish B Sathish

Reputation: 121

I used "IN" instead of "CONTAINS"

Upvotes: 1

Related Questions