[fdo-users] RE: Conditional "IF" in Expressions

Maksim Sestic max at geoinova.com
Wed Jul 18 10:17:47 EDT 2007

Hi Orest,

You're right, it returns different types depending on it's return parameters
(true and false parts). As a rule, both parameters (therefor function's
return value, too) must be of the same type, i.e.:

if(Road.Lanes>1,"Multiple lanes","Single lane")

Here, return value is String - so both params must conform to this rule.
This sort of conditional branching is quite useful when building label
expressions, here's an example:

- Parcel feature class has two data properties - Number and SubNumber (both
are strings)
- if there's subnumber set, then it should display "Number/SubNumber"
(notice slash sign inbetween)
- otherwise, it displays only "Number" part


This happens even more often when it comes to labeling infrastructure
entities, since it's labels depend on multiple states of a network element,

Certainly, labeling is not the only use of conditional branching of that
sort :-)

Maksim Sestic

Orest Halustchak wrote:
> Hi Maksim,
> This seems doable. It's similar to a null value function that some
> providers such as rdbms providers could support: nvl(a,b) which returns
> a if a is not null, otherwise b. In your case it's if(a,b,c) where a is
> boolean. This would need a number of signatures for different data types
> that it would return, e.g. int16 = if(boolean, int16, int16), but
> FdoFunctionDefinition can deal with it.
> The main concern that I would have about it is implementation in an
> efficient manner, although for rdbms providers, SQL includes a CASE
> expression that could be used.
> Thanks,
> Orest.
> -----Original Message-----
> From: fdo-users-bounces at lists.osgeo.org
> [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Maksim Sestic
> Sent: Wednesday, July 18, 2007 4:52 AM
> To: fdo-users at lists.osgeo.org
> Subject: [fdo-users] Conditional "IF" in Expressions
> I was wondering if future versions of FDO will support conditional
> branching
> in Expressions (and Filtering) mechanism, i.e.:
> if(conditional_expression,true_part,false_part)
> if(Road.Lanes>1,"Multiple lanes","Single lane")
> also
> if(Road.Lanes>0,if(Road.Lanes>1,"Multiple lanes","Single lane"),"No
> lanes
> set")
> Useful link:
> http://www.codeplex.com/dotMath Steve Heberts dotMath library 
> Regards,
> Maksim Sestic
> -- 
> View this message in context:
> http://www.nabble.com/Conditional-%22IF%22-in-Expressions-tf4101935s1816
> 2.html#a11664863
> Sent from the fdo-users mailing list archive at Nabble.com.
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users

View this message in context: http://www.nabble.com/Conditional-%22IF%22-in-Expressions-tf4101935s18162.html#a11669595
Sent from the fdo-users mailing list archive at Nabble.com.

More information about the fdo-users mailing list