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.

First, try replacing your problematic IF statement with a DO CASE statement
and see if that works.

If not, do what I always do: Retrieve the value of the alias into a
variable, and then work with the variable.

Object aliases are a little more difficult since you can't assign a null
object to a variable, so you have to do something like:

Dim o as object
Dim o_a as alias

o_a  = "sometab.obj"
...
fetch next from sometab
if (o_a)
   then o=o_a
        do case ObjectInfo (o, OBJ_INFO_TYPE)
           case 4, 7 .....

etc.

HTH
Spencer





________________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nicki Cozens
Sent: Friday, July 28, 2006 9:14 AM
To: [email protected]
Subject: [MI-L] MAPBASIC Object or not Object?

Hi
 
I have what I believe is an object in a layer - I think it's a line - if I
query it in the Maspbasic window in MI with "select objectinfo (obj,1) from
table_name" then look at the selection table I see object type 3 ie a line.
 
If I use the following line in some Mapbasic code which interrogates the
same layer:
 
If ObjectInfo(ColAlias, OBJ_INFO_TYPE) = 4 or ObjectInfo(ColAlias,
OBJ_INFO_TYPE) = 7 then
 
Then I get the following error when it gets to the object that I believe is
a “line”:
 
(Blah.mb:123)ObjectInfo: argument 2 out of range
 
 
If I write what is happening out to a text file ie 
Print #1, (temptablearray(i) +"  "+ colname+"   " +colAlias + "  "+
ObjectInfo(ColAlias, OBJ_INFO_TYPE))  where colAlias is the Alias of the
column name: ColAlias = Temptabname & "." & Colname
 
 
I get the following:
 
Query134
Query134  object   Polyline  4
 
The top line above is the “line” that I think is causing the problem, the
second line above shows a result that works.
 
Is this “line” an object or not and can I do anything to avoid the out of
range error?
 
I hope this all makes sense!!
 
Nicki
 
Nicki Cozens 
Data Management Officer 
Highways Development Control
Leicestershire County Council
County Hall
Glenfield
Leicester
LE3 8RA 
Tel: 0116 265 7420 
Fax: 0116 265 7133
 
  
_______________________________________________________________________
Leicestershire County Council - rated a 'four-star' council by the Audit
Commission
_______________________________________________________________________
 
 
This e-mail and any files transmitted with it are confidential. If you are
not the intended recipient, any reading, printing, storage, disclosure,
copying or any other action taken in respect of this e-mail is prohibited
and may be unlawful. If you are not the intended recipient, please notify
the sender immediately by using the reply function and then permanently
delete what you have received.
 
Incoming and outgoing e-mail messages are routinely monitored for compliance
with Leicestershire County Council's policy on the use of electronic
communications. The contents of e-mails may have to be disclosed to a
request under the Data Protection Act 1998 and the Freedom of Information
Act 2000.
 
The views expressed by the author may not necessarily reflect the views or
policies of the Leicestershire County Council.
 
Attachments to e-mail messages may contain viruses that may damage your
system. Whilst Leicestershire County Council has taken every reasonable
precaution to minimise this risk, we cannot accept any liability for any
damage which you sustain as a result of these factors. You are advised to
carry out your own virus checks before opening any attachment.
 
 



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to