[mapguide-users] Need help with IF-statment in Tool Tip

Martin Morrison martin.morrison at edsi.com
Wed Nov 11 10:39:12 EST 2009


Check for null before you run your if statement...

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kratz Fredrik - SBF
Sent: Wednesday, November 11, 2009 10:35 AM
To: MapGuide Users Mail List
Subject: SV: [mapguide-users] Need help with IF-statment in Tool Tip

BYGGINV_2 is a string, the name of a document (if existing).




Från: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] För Martin Morrison
Skickat: den 11 november 2009 14:43
Till: MapGuide Users Mail List
Ämne: RE: [mapguide-users] Need help with IF-statment in Tool Tip

Is your BYGGINV_2 an integer/double/etc field or is it a string?  As far as I know length only works on a string.

Martin

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kratz
Sent: Wednesday, November 11, 2009 8:41 AM
To: mapguide-users at lists.osgeo.org
Subject: SV: [mapguide-users] Need help with IF-statment in Tool Tip

Here is the error message:

The expression is invalid
Error: Argument types for function 'If' are mismatched. Click here to move the cursor to the error (1)#1
Error: Result types are mismatched: the validation operation expected 'Text' but the expression returned 'Unknown'


It’s the same whether I use  If (  LENGTH(BYGGINV_2) > 0,  BYGGINV_2 , 0)  or If (  LENGTH(BYGGINV_2) > 0,  BYGGINV_2 , ' ' )

I get the feeling that the problem is LENGTH(BYGGINV_2) > 0 but I cant understand how ?

Från: JamesDudden [via OSGeo.org] [mailto:[hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3986496&i=0>]
Skickat: den 11 november 2009 13:31
Till: Kratz Fredrik - SBF
Ämne: Re: [mapguide-users] Need help with IF-statment in Tool Tip

What does the error say? It normally points to which bit is wrong.

Is it the empty string?
Try putting a 0 instead like this:
If (  LENGTH(BYGGINV_2) > 0,  BYGGINV_2 , 0)
Kratz wrote:
Hi!

I need help writing a correct string with an if-statement.

Trying to determine whether an attribute contains any value(string) or not.

Why doesn't this string work?

If (  LENGTH(BYGGINV_2) > 0,  BYGGINV_2 , ' ' )


Default:
If ( [condition], [trueValue], [falseValue] )
Software Matters<http://www.software-matters.co.uk> - Bespoke Database<http://www.software-matters.co.uk/bespoke-database-design.html> and Software Solutions

________________________________
View message @ http://n2.nabble.com/Need-help-with-IF-statment-in-Tool-Tip-tp3985605p3986117.html
To unsubscribe from Need help with IF-statment in Tool Tip, click here.


________________________________
View this message in context: SV: [mapguide-users] Need help with IF-statment in Tool Tip<http://n2.nabble.com/Need-help-with-IF-statment-in-Tool-Tip-tp3985605p3986496.html>
Sent from the MapGuide Users mailing list archive<http://n2.nabble.com/MapGuide-Users-f1803227.html> at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20091111/714a71ab/attachment.html


More information about the mapguide-users mailing list