unique ObjectID column in MapInfo Tab files?

3,672 views
Skip to first unread message

esrispy

unread,
Sep 26, 2007, 10:24:10 AM9/26/07
to MapInfo-L
Is there some way I can get a unique id number from a tabfiles
records?

Shapefiles for example always have a "Counter field" (Objectid) that
you can use to target a special row/object.

My Tabfile does not seem to have unique values in any column (visible)
and only if I combine 2 columns I get unique values.
Since I store values in arrays, and as I understand MapInfo does not
support multidimensional arrays the best bet wold be to use some
(hidden?) object column if there are one?
Or create som type of "Counter" type Column in my Tab file

So is there some column I can use Or do I have to create some type of
column for this?
Are there some type of filed (type) that supports increment, like
counter in access for example?

Lawley, Russell S

unread,
Sep 26, 2007, 10:35:31 AM9/26/07
to mapi...@googlegroups.com
Hello EsriSpy,


its a two step process...

1 add an extra column to your table of type 'integer'
2 use the Table>update-column menu to update this new column: in the update dialog box enter the magic word rowid in the lowermost edit box (dont forget to make sure you select teh correct column to update!)

This will update your table with an incremental counter.

russkin




-----Original Message-----
***************************************************************************************************************
This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
***************************************************************************************************************

winmail.dat

esrispy

unread,
Sep 26, 2007, 10:39:59 AM9/26/07
to MapInfo-L
Thanks //Martin

> ***************************************************************************­************************************


> This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.

> ***************************************************************************­************************************
>
>
>
> winmail.dat
> 6KHämta- Dölj citerad text -
>
> - Visa citerad text -

Sitaneph

unread,
Sep 27, 2007, 6:52:22 PM9/27/07
to MapInfo-L
There actually is a column which has a unique number for the row but
it is not displayed in the browser window but you can use it when
writing code (though not in the MapBasic window in MapInfo). The
column is called MAPINFO_ID and is always the first column in the
table. You can actually see it if you export the table to MS Access.

Some key things to remember about this column though is that the value
can change. If you delete some records in the table and then pack the
table it Mapinfo automatically updates this column so that the ID
numbers are sequential. So if you are using the ID as a reference in
other tables this can totally screw things up (I know this from
experience!). This is also why you should never use this field as a
reference lookup field when keeping tables in Access, as Mapinfo does
not update the associated reference fields in other tables.

esrispy

unread,
Oct 11, 2007, 5:29:28 AM10/11/07
to MapInfo-L
How do you grab that field?

Select MAPINFO_ID, Money from myDaddysWallet into myWallet

Does not seem to work...

Uffe Kousgaard

unread,
Oct 11, 2007, 5:39:04 AM10/11/07
to mapi...@googlegroups.com
The field is called rowid and is only available for use in some situations:

1) For labelling
2) For updating another field such as "myfield = rowid+2"
3) For updating record(s): update mytable set myfield=2 where rowid=17
4) For selecting records: select * from mytable where rowid<100
5) More?

You can not select rowid as a field as you try below. MapInfo_ID is
something else and specific to access tables afair.

Regards
Uffe Kousgaard

Driver, Greg 9434

unread,
Oct 11, 2007, 5:54:25 AM10/11/07
to mapi...@googlegroups.com
You can add an integer column to myDaddysWallet called MAPINFO_ID and
then use Table -> Update Column to set this column to the value of
rowid.

You can then perform your SQL statement.

HTH

Greg Driver

System Administrator
Applications Support
ICT
NOT PROTECTIVELY MARKED

Reply all
Reply to author
Forward
0 new messages