cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-41331%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EJSL%3A%20Indizieren%20und%20Navigieren%20durch%20alle%20in%20JMP%20ge%C3%B6ffneten%20Tabellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41331%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EIch%20erstelle%20eine%20JMP-App%20und%20muss%20in%20der%20Lage%20sein%2C%20die%20Anzahl%20der%20von%20mir%20ge%C3%B6ffneten%20Tabellen%20zur%C3%BCckzugeben%20und%20durch%20mehrere%20Tabellen%20zu%20navigieren%2C%20damit%20der%20Benutzer%20eine%20Tabelle%20ausw%C3%A4hlen%20kann%2C%20mit%20der%20er%20arbeiten%20m%C3%B6chte.%20Angenommen%2C%20Sie%20haben%20drei%20Tische%20ge%C3%B6ffnet%20und%20erstellen%20im%20App%20Builder%20einen%20Drehpfeil%20(Pfeile%20nach%20oben%2Funten).%20Wenn%20Sie%20nach%20oben%20klicken%2C%20wird%20die%20n%C3%A4chste%20Tabelle%20oben%20zur%20aktuellen%20Datentabelle%2C%20und%20wenn%20Sie%20nach%20unten%20klicken%2C%20wird%20die%20Tabelle%20unten%20zur%20aktuellen%20Datentabelle.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIndex%201%20%E2%80%93%20Tabelle%20A%3C%2FP%3E%3CP%3E*nach%20oben%20klicken*%3C%2FP%3E%3CP%3EIndex%202%20%E2%80%93%20Tabelle%20B%3C%2FP%3E%3CP%3E*nach%20oben%20klicken*%3C%2FP%3E%3CP%3EIndex%203%20%E2%80%93%20Tabelle%20C%3C%2FP%3E%3CP%3E*nach%20oben%20klicken*%3C%2FP%3E%3CP%3EIndex%202%20%E2%80%93%20Tabelle%20B.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIch%20verwende%20diesen%20Code%2C%20um%20Tabellen%20zu%20indizieren%20und%20herauszufinden%2C%20wie%20viele%20Tabellen%20ge%C3%B6ffnet%20sind.%20Die%20Fehlermeldung%2C%20die%20ich%20erhalte%2C%20ist%2C%20dass%20Data%20Table%20()%20nichts%20verstehen%20kann%2C%20was%20keine%20konstante%20Ganzzahl%20ist.%20Jedes%20Mal%2C%20wenn%20ich%20eine%20Variable%20einf%C3%BCge%20(zu%20Inkrementierungszwecken)%2C%20erhalte%20ich%20zur%C3%BCck%2C%20dass%20die%20Datentabelle%20das%20Innere%20der%20Klammern%20nicht%20identifizieren%20kann.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDie%20while-Anweisung%20funktioniert%20folgenderma%C3%9Fen%3A%20Wenn%20Datentabelle%20(1)%20auf%20Tabelle%20A%2FB%2FC%20verweisen%20kann%2C%20gibt%20sie%20%E2%80%9ETabelle%20A%2FB%2FC%E2%80%9C%20zur%C3%BCck%2C%20und%20wenn%20ich%20Type()%20darauf%20aufrufe%2C%20gibt%20sie%20%E2%80%9ETabelle%E2%80%9C%20zur%C3%BCck.%20Wenn%20also%20die%20while-Schleife%20auf%20Data%20Table(4)%20trifft%2C%20gibt%20es%20keine%20Tabelle%2C%20auf%20die%20ein%20Verweis%20zur%C3%BCckgegeben%20werden%20kann%2C%20was%20bedeutet%2C%20dass%20es%20keinen%20Typ%20%E2%80%9ETable%E2%80%9C%20geben%20wird%2C%20der%20die%20while-Schleife%20beendet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile(%20(Type(%20Data%20Table(%20i%2B%2B%20)%20)%20%3D%3D%20%22Table%22)%2C%3CBR%20%2F%3E%20numberOfTables%2B%2B%2C%3CBR%20%2F%3E%20)%3B%3C%2FP%3E%3CP%3EPrint(%22Anzahl%20der%20Tische%22)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDas%20%C3%84ndern%20von%20%E2%80%9Ei%E2%80%9C%20kann%20f%C3%BCr%20die%20zuvor%20erw%C3%A4hnten%20Pfeilschaltfl%C3%A4chen%20verwendet%20werden%2C%20und%20%E2%80%9EnumberOfTables%E2%80%9C%20gibt%20mir%20einen%20Maximalwert%2C%20der%20f%C3%BCr%20%E2%80%9Ei%E2%80%9C%20nicht%20%C3%BCberschritten%20werden%20darf.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EVielen%20Dank%20f%C3%BCr%20die%20Hilfe%20im%20Voraus.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41332%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20JSL%3A%20Indizieren%20und%20Navigieren%20durch%20alle%20in%20JMP%20ge%C3%B6ffneten%20Tabellen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41332%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDie%20Funktion%20N%20Table()%20gibt%20die%20Anzahl%20der%20ge%C3%B6ffneten%20Datentabellen%20zur%C3%BCck.%20Sie%20k%C3%B6nnen%20ihre%20Namen%20dann%20durch%20Durchlaufen%20ermitteln%3C%2FP%3E%0A%3CP%3Efor(i%3D1%2Ci%26lt%3B%3DN%20Table()%2Ci%2B%2B%2Cname%3Ddata%20table(i)%26lt%3B%3CGET%20name%3D%22%22%3E%3C%2FGET%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
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

Recommended Articles