The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Highlighted
Level VII

## How to get multiple open data table file names for JSL?

Hi:
Assuming that two datatable files have been opened but no table Numbers have been entered in advance, how do can get multiple datatable file names that have been opened?How to jump from the current file to another file?Thank you!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User

## Re: How to get multiple open data table file names for JSL?

You can find out the number of open tables with the N Table() function, and then get each name by looping through the open tables and asking for each table's name

``````Names Default To Here( 1 );
For( i = 1, i <= N Table(), i++,
Show( Data Table( i ) << get name )
);``````

Below is one example of how I deal with the need to point directly at a data table, which allows one to switch between them.

``````Names Default To Here( 1 );

dtLIst = {};

For( i = 1, i <= N Table(), i++,
dt = data table(i);
insert into(dtList, dt );
);

eval(dtList[1]) << new column("added column", set each value(5));

dtList[2] << bivariate();``````

Jim
Highlighted
Level V

## Re: How to get multiple open data table file names for JSL?

This ability may be newer than this thread but since I was just searching out the syntax for this (and sometimes the community seems the easy place to search) I thought I'd note here that there is a function GetDataTableList() to directly get a list of open table names.

4 REPLIES 4
Highlighted
Super User

## Re: How to get multiple open data table file names for JSL?

You can find out the number of open tables with the N Table() function, and then get each name by looping through the open tables and asking for each table's name

``````Names Default To Here( 1 );
For( i = 1, i <= N Table(), i++,
Show( Data Table( i ) << get name )
);``````

Below is one example of how I deal with the need to point directly at a data table, which allows one to switch between them.

``````Names Default To Here( 1 );

dtLIst = {};

For( i = 1, i <= N Table(), i++,
dt = data table(i);
insert into(dtList, dt );
);

eval(dtList[1]) << new column("added column", set each value(5));

dtList[2] << bivariate();``````

Jim
Highlighted
Level VII

## Re: How to get multiple open data table file names for JSL?

Thank Jim!

VBA：ActiveWindow.ActivateNext
Highlighted
Level V

## Re: How to get multiple open data table file names for JSL?

This ability may be newer than this thread but since I was just searching out the syntax for this (and sometimes the community seems the easy place to search) I thought I'd note here that there is a function GetDataTableList() to directly get a list of open table names.

Highlighted
Level VII

## Re: How to get multiple open data table file names for JSL?

GetDataTableList() does not work if the table is already open.
So I'm going to use the Jim's method.

Article Labels

There are no labels assigned to this post.