No, I've found that aliases (especially objects) can act strangely if you try to extract their values more than once between two successive fetches. Maybe newer versions of MapInfo are more robust, but it conditioned me to always fetch aliases into variables back in the 1990s.
Using "degenerate" objects to simulate null objects is useful, but it doesn't help fetching them from a table, because you can't guarantee that a row didn't have its object deleted. It looks as if the original poster actually included mapbasic.def since his print statement worked. There may also be some subtle corruption that a Pack Table would reveal. HTH Spencer -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Thoen Sent: Friday, July 28, 2006 10:27 AM To: [email protected] Subject: Re: [MI-L] MAPBASIC Object or not Object? Spencer Simpson wrote: >I'm not going to pretend I understand what's going on. However, I've found >that aliases act flaky if you refer to them too many times between fetches. > > I don't think they're flakey, you just have to understand how they work. Every time you fetch a new record, that updates the alias. If you need a variable that doesn't chnage with fetch, then as you say, use a normal variable. >Object aliases are a little more difficult since you can't assign a null >object to a variable... > > Another way to simulate a null object in a variable is to assign it to an object that has no dimension (e.g. a line with the start and end point in the same place, or pline or region with 0 nodes). Then to test "null-ness" check it's length or area and see if it's zero. I often use this technique in functions that return an object when a bad situation would otherwise cause a crash. _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
