Subscribe Bookmark RSS Feed

JSL: Index and Navigate through All Tables Open in JMP

Brown

New Contributor

Joined:

Jun 21, 2017

I'm building a JMP App and I need to be able to return the number of tables I have open as well as navigate through multiple tables so the user can select a table to work with. Say you have 3 tables open and you build a spin arrow in the app builder (up/down arrows). If you click up, the next table up becomes the Current Data Table, and similary for clicking down, the table down becomes the Current Data Table.

 

Index 1 - Table A

*click up*

Index 2 - Table B

*click up*

Index 3 - Table C

*click up*

Index 2 - Table B.

 

i am using this code to index tables and find out how many tables are open. The error I'm receiving is that Data Table () cannot understand anything that is not a constant integer. Any time I put a variable (for incrementing purposes) I receive back that Data Table cannot identify the inside of the parentheses.

 

The way the while statement works is if Data Table (1) can reference Table A/B/C, it will return "Table A/B/C", and when I call Type() on it, it returns "Table". So, by the time the while loop hits Data Table(4), theres no table to return a reference to, meaning there will be no type "Table" ending the while loop.

 

While( (Type( Data Table( i++ ) ) == "Table"),
numberOfTables++,
);

Print("Number of tables");

 

Changing "i" can be used for the arrow buttons mentioned before, and numberOfTables will give me a max value not to exceed for "i".

 

Thanks for help in advance.

1 REPLY
txnelson

Super User

Joined:

Jun 22, 2012

The function N Table() will return the number of data tables open. You can then get their names by looping through

for(i=1,i<=N Table(),i++,name=data table(i)<<get name)

Jim