0

I try to get data from table use MapBasic:

Dim nCol = "ColumnName"
Fetch First From Untitled
Do While Not EOT(Untitled)
  colValue = Selection.nCol
Note colValue
Fetch Next From Untitled
Loop

Compilation ends success but when i start application in MapInfo get error:

Not defined Selection.nCol

How to work with columns in this case?

1 Answer 1

2

I believe you need to use an alias, something like this (untested)

Dim nCol as alias
Fetch First From Untitled
Do While Not EOT(Untitled)
    nCol = Untitled + ".ColumnName"
    colValue = nCol
    Note colValue
    Fetch Next From Untitled
Loop
2
  • If your table name as well as your column are hard coded, you don't need an Alias variable, you can just refer to the combination of these two names: Untitled.ColumnName. If one of them is a variable, you need to go thru an Alias variable Commented Jul 29, 2013 at 7:22
  • Also quick note that if you can't hardcode a column name, you can get columns dynamically by column number like .col2 or .col(2) Commented Oct 25, 2013 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.