Conditional Expression

Stimulsoft Reports.NET discussion
Post Reply
fkmfkm
Posts: 181
Joined: Thu Jul 05, 2007 11:26 pm
Location: Kuala Lumpur

Conditional Expression

Post by fkmfkm »

Can I do something like this in a Text Object ?

if {Table.Field} = 'A' then
'Active'
Else If {Table.Field} = 'X' Then
'Dead'
Else
'Unknown'
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Conditional Expression

Post by Alex K. »

Hello,

Please try to use the following text expression:

Code: Select all

{IIF(Table.Field == "A", "Active", IIF(Table.Field == "X", "Dead", "Unknown"))}
Thank you.
fkmfkm
Posts: 181
Joined: Thu Jul 05, 2007 11:26 pm
Location: Kuala Lumpur

Re: Conditional Expression

Post by fkmfkm »

Yup thats working...

Just another twist...can I code like this ? Don't really like the long long code.

{IIF(Table.Field == "A", "Active", "")}
{IIF(Table.Field == "X", "Dead", "")}
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Conditional Expression

Post by HighAley »

Hello.

You will get empty fist line if Field is not A.
It's better to use Switch function.

Thank you.
Post Reply