Subscribe Bookmark RSS Feed

Table ordering

ron_horne

Super User

Joined:

Jun 23, 2011

Hi All,

I have a script that opens and closes a few tables. I was wondering whether there is a way of changing the order of the open tables? Once I close a table the active table becomes the last in the list of open tables and not the previous active one.

For example:


dt1 = Open( "$SAMPLE_DATA/Cities.jmp" );

dt2 = Open( "$SAMPLE_DATA/Big Class.jmp" );

// set the first active table to be current

Current data table (dt1);

// open and close another table

dt3 = Open( "$SAMPLE_DATA/Cars.jmp" );

Wait (2);

Close (dt3, no save);

// check which table is currently active?

Current data table ();


At this point dt2 is active while I would like dt1 to be active since it was the last active one before opening and closing dt3. For that I need to do this again:


Current data table (dt1);

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Ron,

I am not aware of how to change the order of the tables in the open data tables list.  I have been bit too many times in the past when I had written code that did not specifically point to the data table.  A simple examples are, staying away from For Each Row.  And when referencing a column in a data table I use the data table namespace (i.e. dt:column name). When referencing a platform, I always pass it as a message to the data table......dt << Graph Builder..... It also has helped in the evolving of scripts from one release to the next.  One of the items that I have had to overcome in the past has been resolving issues where the "Current Data Table" at a given point in a script is different from one release to the next.  JMP 12 helps with this too.  The "Summarize" function now has a new optional first parameter, where you can specify the precise data table to work on. 

Jim
2 REPLIES
Solution

Ron,

I am not aware of how to change the order of the tables in the open data tables list.  I have been bit too many times in the past when I had written code that did not specifically point to the data table.  A simple examples are, staying away from For Each Row.  And when referencing a column in a data table I use the data table namespace (i.e. dt:column name). When referencing a platform, I always pass it as a message to the data table......dt << Graph Builder..... It also has helped in the evolving of scripts from one release to the next.  One of the items that I have had to overcome in the past has been resolving issues where the "Current Data Table" at a given point in a script is different from one release to the next.  JMP 12 helps with this too.  The "Summarize" function now has a new optional first parameter, where you can specify the precise data table to work on. 

Jim
ron_horne

Super User

Joined:

Jun 23, 2011

thank you txnelson​,

i was starting to notice the same, that each command needs to have an explicit table target and that actually the "for each row" is dangerous with more than one table open.

ron