0

I would like to know what commands/statement can open (or select) multiple tables in MapBasic?. Please show me?

1

The syntax is:

Open Table "*<path of table>*"

For example

Open Table "C:\Temp\table1.TAB"
Open Table "D:\GISDATA\points.TAB"

etc

EDIT or to list open tables in a session use MapBasic:

Dim i as integer   
Dim j as integer
Dim TableArray(1) as String
ReDim TableArray(i)

i = NumTables()
 For j = 1 to i TableArray(j) = Tableinfo(j, TAB_INFO_NAME)
 Next
  • Thanks you! But i want open multiple tables at once (example: open table table1.tab and points.tab by one comand. Do you know? – Nguyễn Việt Hưng Jan 12 '15 at 2:59
  • You could write a function and pass a string variable to it with an array of table names... Which would be much more work than just having a series of Open Table commands! :) Is there a particular reason why you're trying to do this? – Morgan Ellingham Jan 12 '15 at 3:17
  • Thanks you, Mr. Morgan Ellingham. I'm a beginer. I'm trying to creat a legend table from multiple tables which tables i will select. So, the command to open multiple tables very important for my code. Thanks you so much. – Nguyễn Việt Hưng Jan 12 '15 at 17:08
  • So you want a table with all the names of the currently open tables in your session? If so, you could use: Dim i as integer Dim j as integer i = NumTables() Dim TableArray(1) as String ReDim TableArray(i) For j = 1 to i TableArray(j) = Tableinfo(j, TAB_INFO_NAME) Next – Morgan Ellingham Jan 12 '15 at 23:37
  • I'll put it in as an answer, if it works let us know! – Morgan Ellingham Jan 14 '15 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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