Hi Matt,

You are able to do this by using some simple logic in your label expression. 
Here is how to do it:

Left$(Str$(PID), Int(PID <> 0) * Len(Str$(PID))) + Left$(Str$(POT_PID), 
Int(POT_PID <> 0) * Len(Str$(POT_PID)))

The trick here is to use the left$() function to extract a number of characters 
from the column. The number of characters is either 0 or them all. It is 0 if 
the expressions (PID <> 0) or (POT_PID <> 0) evaluate to true which they will 
do if they are not zero. 

The Int() function is just used to convert the logical value to a number, 
either 0 (false) or 1 true. 

Here after we multiply this value with the length of the value in the column.

Note that the Str$() function is used to convert the number to a string to be 
able to use the Left$() and Len() function on these.

HTH,

Peter Horsbøll Møller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 14, 2005 12:45 AM
To: mapinfo-l@lists.directionsmag.com
Subject: MI-L Label query


Hello MapInfo listers,

I want to label polygons according to one of two fields (PID and POT_PID). 
In our data, a polygon has a real value for either one of these two 
fields, and a zero value for the other. I was wondering if it'd be 
possible to write a query that would label polygons according to the real 
value from either of these fields.

Thanks in advance,

Matt Davis,
Project Officer,
Crown Land Assessment and Classification Project,
Department of Primary Industries, Water and Environment
Level 5, 134 Macquarie Street, Hobart

Telephone: (03) 6233 5112
Fax: (03) 6233 6655
E-mail: [EMAIL PROTECTED]
Mailing address: GPO Box 44, Hobart, TAS, 7000

For further information on the Crown Land Assessment and Classification 
Project, visit our webpage at:
http://www.dpiwe.tas.gov.au/clac

CONFIDENTIALITY NOTICE AND DISCLAIMER

The information in this transmission may be confidential and/or protected 
by legal professional privilege, and is intended only for the person or 
persons to whom it is addressed. If you are not such a person, you are 
warned that any disclosure, copying or dissemination of the information is 
unauthorised. If you have received the transmission in error, please 
immediately contact this Office by telephone, fax or email, to inform us 
of the error and to enable arrangements to be made for the destruction of 
the transmission, or its return at our cost. No liability is accepted for 
any unauthorised use of the information contained in this transmission.

If the transmission contains advice, the advice is based on instructions 
in relation to, and is provided to the addressee in connection with, the 
matter mentioned above. Responsibility is not accepted for reliance upon 
it by any other person or for any other purpose.

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14839

Reply via email to