Convert IF THEN ELSE to CASE statement

Printed From: Crystal Reports Book — Forum Name: Technical Questions

I have the below if then else statement and need help converting to a CASE statement.

if(isnull({@cond1})=false) then 'Cond1'
else if(isnull({@cond2})=false) then 'Cond2'
else if({Command.Age}<3) then 'Under 3'
else if({Command.Age}>17) then 'Above 18'
else 'Between 3 to 17'

This categorizes each element only to one column and that is incorrect. Need the element to be counted in multiple columns. Eg. in 'Cond1' column and one of the age columns or 'Cond1' and 'Cond2' and one of the age columns.

Thanks in advance!
I am assuming that you are using MS-SQL.

case when {@cond1} is not null then 'Cond1'
        when {@cond2} is not null then 'Cond2'
        when {Command.Age} < 3 then 'Under 3'
        when {Command.Age} > 17 then 'Above 18'
        else 'Between 3 to 17' end
Thank you!