Hi Ryan,
You can get selection information from the SelectionInfo( ) function:
Dim sSelName as String
Dim aSelID as Alias
Dim nID as Integer
sSelName = SelectionInfo(SEL_INFO_SELNAME) 'Get the name of the selection table
aSelID = sSelName & ".polyline_ID" 'Set an alias to your polyline ID column in the selection table
If SelectionInfo(SEL_INFO_NROWS) = 1 then 'Check how many records in selection. If 1 then:
Fetch first from sSelName 'Get first record
nID = aSelID 'Get ID from selection and store in variable
Select * from DataTable where polylinedata_ID = nID into "OutTable_" & nID 'Select from data table where ID matches
Else
'Greater than or less than 1 polyline selected
End if
This assumes that your ID column is an Integer type and that you only want to deal with selections of 1 object. You may need to make some small alterations to get this to fit your data.
Hope this helps,
Tom Bacon
GIS Engineer | Asset Management South
The Mouchel Group
37-39 Perrymount Road, Haywards Heath, West Sussex RH16 3BN
Office: 01444 472330
Direct: 01444 472380
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
Hi Ryan,
You can get selection information from the SelectionInfo( ) function:
Dim sSelName as String
Dim aSelID as Alias
Dim nID as Integer
sSelName = SelectionInfo(SEL_INFO_SELNAME) 'Get the name of the selection table
aSelID = sSelName & ".polyline_ID" 'Set an alias to your polyline ID column in the selection table
If SelectionInfo(SEL_INFO_NROWS) = 1 then 'Check how many records in selection. If 1 then:
Fetch first from sSelName 'Get first record
nID = aSelID 'Get ID from selection and store in variable
Select * from DataTable where polylinedata_ID = nID into "OutTable_" & nID 'Select from data table where ID matches
Else
'Greater than or less than 1 polyline selected
End if
This assumes that your ID column is an Integer type and that you only want to deal with selections of 1 object. You may need to make some small alterations to get this to fit your data.
Hope this helps,
Tom Bacon
GIS Engineer | Asset Management South
The Mouchel Group
37-39 Perrymount Road, Haywards Heath, West Sussex RH16 3BN
Office: 01444 472330
Direct: 01444 472380
You’re welcome. Oh, and don’t forget to add: Include “MapBasic.def”
at the top of your code (outside of any subprocedures) for the definitions of the SelectionInfo parameters.
Regards,
Tom Bacon
GIS Engineer | Asset Management South
The Mouchel Group
37-39 Perrymount Road, Haywards Heath, West Sussex RH16 3BN
Office: 01444 472330
Direct: 01444 472380

Hi Ryan,
I would use the following functions (check out the MapBasic reference guide, it’s got some great examples and details all the functions available to you in MapBasic):
FrontWindow( ) - Gets the window ID of the front window
WindowInfo(WIN_INFO_TYPE) - Get the window type (you want it to be WIN_MAPPER otherwise you haven’t got a map window as your front window)
MapperInfo(MAPPER_INFO_LAYERS) - Get the number of layers in the map window
LayerInfo(LAYER_INFO_NAME) - Get the name of a layer.
If you test the frontwindow ID and it is a Map window, then get the number of layers in the window. Then loop through the layers and set selectable OFF for all those which aren’t the polyline layer. This does assume that you know the name of the polyline layer (remember a table name is limited to 31 characters, so if the filename is longer than this you only want the first 31 characters).
Hope this helps,
Tom Bacon
GIS Engineer | Asset Management South
The Mouchel Group
37-39 Perrymount Road, Haywards Heath, West Sussex RH16 3BN
Office: 01444 472330
Direct: 01444 472380
In fact you can use SelectionInfo(SEL_INFO_TABLENAME) to get the name of the layer that the selection was based on.
Tom Bacon
GIS Engineer | Asset Management South
The Mouchel Group
37-39 Perrymount Road, Haywards Heath, West Sussex RH16 3BN
Office: 01444 472330
Direct: 01444 472380