cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Brown
Level I

JSL: Index and Navigate through All Tables Open in JMP

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 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL: Index and Navigate through All Tables Open in JMP

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

View solution in original post

1 REPLY 1
txnelson
Super User

Re: JSL: Index and Navigate through All Tables Open in JMP

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