On Wed, 8 Dec 2004, Hughes, Colleen / Don Mitchell wrote:

> I am not familiar with nulls in MapBasic myself, but I noticed in MapInfo a
> null is a 0 (zero) if the field is numeric and a string field is an empty
> string (i.e. "").  At least this is how it is handled in the SQL.
> 
> In a string situation, is the empty string in quotations also evaluated as 0
> (zero) programmatically by MapInfo?

No, an empty string type is not treated as a zero (unless you convert it
to a numeric with the Val() function.) It's just an empty string. Note
that an empty string ("") for a string type or a zero for a numeric type
are within the valid rnages of their respective types. There is no such
thing as a null value built into MapInfo/MapBasic. If you want a null, you
have to impose a convention to do it.

To get around this, people often use a particular value that's outside the
range of likely values -- like -9999 for elevations, or "UNNAMED" for
small town names, etc. But for some data there's no value in the valid
range of the type that can be ruled out as unlikely, and if you need a
null in those cases, then you'd better consider storing the value as a
string, and only converting it as needed (a string can store anything as
long as you can fit your data into 254 characters or less... and if you
still need more room, you can use multiple strings.)

- Bill Thoen



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

Reply via email to