What you want is called an immediate if function, and yes, it's
VERY handy. The syntax is:

Result = iif(<ConditionExpression>, <ExpressionTrue>,
<ExpressionFalse>)

The way it works is that if ConditionExpression is true, return
the result of ExpressionTrue, otherwise return the result of
ExpressionFalse. You can even nest iif() expressions within it.
In your example, you set labels to 

Label = iif(ColumnA="T", "X", "S")

You could even get fancier:
Label = iif(ColumnA="T", iif(ColumnB="C", "!", "?"), "S")

This says if ColumnA is a "T", then check ColumnB, and if ColumnB
is a "C" then Label is "!". Otherwise it's a "?". But if ColumnA
was not a "T", then label is an "S".

This function has been around since the days of dBase II.  It's
not in MapInfo, and that's a pity. It's on page 3 of the MapInfo
wish list (see
http://www.directionsmag.com/wishlist.asp?ID=49&Action=&Sort=&Page=3&Pagesize=10),
and only has a couple of votes (and all of them say this is "very
important").

- Bill Thoen


Jason Dettman wrote:
> 
> Is there a way to have an "If...Then..Else" statement in a label
> expression???
> For example:
> 
> If columnA ="T"  Then
>  Label = "X"
> Else
>  Label ="S"
> End IF
> 
> Thanks...Roy
> 
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to