originalTable.rowID returns the rowID of the first selected object, in
the originalTable, which is what I want. Unfortunately, I can't get it
to return more than the first, and additionally, I don't always know
which table the selection is being made on (I can find out using
SelectionInfo(SEL_INFO_TABLENAME), but how do I query tableName.rowID,
when "tableName" is a string returned from a function?).
I'm stuck. Real stuck.
Matt
It sounds as though you need an 'Alias' variable.
You could append ".rowID" to your return value string and store that in
your alias variable to reference the value of that column.
David
Matt
If this email has been received in error, please delete all copies and inform the National Native Title Tribunal by return email or telephone 1800 640 501. The Tribunal does not warrant that its email is virus free. All emails sent to the Tribunal are filtered for viruses and inappropriate content. Thus your email may not reach the person to whom it is addressed. Seek confirmation of receipt of your email if you consider the email important.
I didn't even realise there was a type called "alias". That helps out a
lot. A massive amount, actually.
Using A Fetch First / Fetch Next loop doesn't seem to cycle through the
rowIDs. It does cycle through the Selection.rowIDs, but not through the
originalTable.rowIDs.
The only way I am aware of is by using the SelChangedHandler and
CommandInfo(CMD_INFO_ROWID).
This however means selecting every record in the query and therefore
may be a bit cumbersome - not to mention annoying to the user to see
everything flash.
As an example the following code will print the original rowid of the
records in a query called tmp
-----------------------------------------------------------------------------------------------------------------------------
Include "mapbasic.def"
Declare Sub Main
Declare Sub SelChangedHandler
Dim i as integer
Dim j as integer
Dim sTab as string
Sub Main
sTab = "tmp" '<-- the name of the Query you want hte ID's for
j = tableinfo(tmp,tab_info_nrows)
for i = 1 to j
select * from tmp where rowid = i into xxTmp
next
end sub
Sub SelChangedHandler
if SelectionInfo(SEL_INFO_NROWS) = 1 then
print "The recod in row " & i & " of Query "
& stab & " is from row "
& CommandInfo(CMD_INFO_ROWID)
& " of table "
& selectioninfo(SEL_INFO_TABLENAME)
end if
end sub
-----------------------------------------------------------------------------------------------------------------------------
Hope this helps
Regards
Martin
It is interesting that you mention obtaining only the first tablename.
Within MapInfo, although several tables may be enabled for selection in
Layer Control, I found that only objects of one table are able to be
selected in a group.
You may have better control creating your own toolbutton and using functions
SearchPoint() or SearchRectangle() followed by SearchInfo() if you wish to
determine the objects found at a location selected the user.
Rgds
Darren
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of Matt
Sent: Thursday, January 18, 2007 12:40 AM
To: MapInfo-L
Subject: [MI-L] Returning rowIDs of selected objects
I did a bit of experimenting. It is the CommandInfo(CMD_INFO_ROWID)
that does the trick. No need to use the SelChangedHandler. In fact, it
is better not to, because it is called when something is deselected,
and CommandInfo(CMD_INFO_ROWID) can also return the last deselected
rowID.
Just put CommandInfo(CMD_INFO_ROWID) into the main loop.