Or you could use the Alias variable to hold the table and column names
 
Dim aCol As Alias,

    selColumnId as integer,

    selColumnName as String

 

    selColumnId     = <number retrieved from dialog>

    selColumnName   = ColumnInfo(MyTable,"col"+selColumnId,COL_INFO_NAME)

    aCol            = "MyTable." &  selColumnName

 

    select aCol

        from MyTable

 
HTH,
 

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Spencer Simpson
Sent: Thursday, October 05, 2006 4:56 PM
To: 'Francois Blanc'; [email protected]
Subject: RE: [MI-L] Dynamic expressions in select clauses

Run Command "Select"+selColumnName+" from "+MyTable

 

or

 

Run Command "Select"+selColumnName+" from MyTable"

 

depending on whether MyTable is a variable or not.

 

HTH

Spencer

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francois Blanc
Sent: Thursday, October 05, 2006 10:23 AM
To: [email protected]
Subject: [MI-L] Dynamic expressions in select clauses

 

Hi,

 

I have been trying unsuccessfully to pass a dynamic _expression_ into a select clause in MapBasic. I thought it would be straitforward but somehow it is trickier than I expected. Here is what I did

 

First I retrieved column number n in MyTable from a list in a dialog box (works fine). I would then like to select that column from the table. I wrote the following code:

 

  Dim selColumnId as integer

  Dim selColumnName as String

  selColumnId = <number retrieved from dialog>

  selColumnName = ColumnInfo(MyTable,"col"+selColumnId,COL_INFO_NAME)

  select selColumnName from MyTable

 

This gives me a single column filled with the String <columnName>. Any idea how I should proceed instead?

 

Thanks,

 

 

Francois Blanc

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

Reply via email to