COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: juffin on 21 Oct 2013 02:04:00 PM

Title: Report Condition - IF Statement
Post by: juffin on 21 Oct 2013 02:04:00 PM
Hi,
I'm writing a report condition in Report studio as below.
My logic is if month = 1,2,3, or 4 then keep the same month else put month as 9

IF ( [Query1].[CONVERSION_MONTH]) < '5' THEN
    ( [Query1].[CONVERSION_MONTH] )
ELSE
    ( [Query1].[CONVERSION_MONTH] = '9' ) END

but i am getting a parsing error - RSV-VAL-0034 Failed to validate the variable

Anyone has any clue on what the issue is ?
Thanks in advance.
Regards
Jf
Title: Re: Report Condition - IF Statement
Post by: sir_jeroen on 21 Oct 2013 03:49:11 PM
remove END...
It's IF.. THEN ELSE...
and
CASE WHEN... THEN... ELSE ... END
Title: Re: Report Condition - IF Statement
Post by: HalfBloodPrince on 21 Oct 2013 04:10:42 PM
 ( [Query1].[CONVERSION_MONTH] = '9' ) is causing error.

create new query calculation  with name Conversion month 9 as if( [Query1].[CONVERSION_MONTH] = '9' ) then ([Query1].[CONVERSION_MONTH] ) else ('')

then
IF ( [Query1].[CONVERSION_MONTH]) < '5' THEN
    ( [Query1].[CONVERSION_MONTH] )
ELSE
    ( [Query1].[Conversion month 9] )
Title: Re: Report Condition - IF Statement
Post by: Satheesh on 22 Oct 2013 04:29:28 AM
hi
write the Condition like below




IF ( [Query1].[CONVERSION_MONTH] < '5' ) THEN
    ( [Query1].[CONVERSION_MONTH] )
ELSE
    ('9' )
Title: Re: Report Condition - IF Statement
Post by: juffin on 28 Oct 2013 09:09:13 PM
thanks all..it worked  :)