cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
galactus3000
Level IV

Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

My typical workday involves the creation of multiple tables each of which may have multiple graphs/analyses.

Is there away, for a given table, to automatically save all of its open graphs/analyses as scripts in the table itself (and then, optionally, close all of the graphs).

Having some patience issues in exiting the JMP program and having to save all the tables without losing the analyses.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

Here's a start: It covers many cases, and could be made smarter. You could put it on a menu item or buton for convenience:

Names Default To Here(1);
// Open a table to play with
dt = Open("$SAMPLE_DATA\Big Class.jmp");
// Open some windows in the session from this table (this would be done interactively)
ss = dt << Get Table Script Names;
for (s=1, s<=NItems(ss), s++, dt << runScript(ss[s]));
// Delete the saved scripts from the table
for (s=1, s<=NItems(ss), s++, dt << deleteTableProperty(ss[s]));
Wait(3);

// Start here . . .

// See the names of all the tables that are currently open in ths session
openTables = {};
for(t=1, t<=NTable(), t++, InsertInto(openTables, DataTable(t) << getName));

// See which windows are currently open in the session
openWindows = {};
for(w=1, w<=NItems(Window()), w++, InsertInto(openWindows, Window(w) << getWindowTitle));

// Handle each open table in turn
for(t=1, t<=NItems(openTables), t++,
	// Truncate the table name if required
	if(EndsWith(Uppercase(openTables[t]), ".JMP"), openTables[t] = Substr(openTables[t], 1, Length(openTables[t])-4));
	for(w=1, w<=NItems(openWindows), w++, 
		If(StartsWith(openWindows[w], openTables[t]),
			// This windows belongs to this table, so get the scriptable object
			so = Window(openWindows[w])[OutlineBox(1)] << getScriptableObject;
			// Save the script to the parent data table
			so << saveScriptToDataTable;
			// Close the window
			Window(openWindows[w]) << closeWindow;
			);
		)
	);

View solution in original post

6 REPLIES 6
ian_jmp
Level X

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

Here's a start: It covers many cases, and could be made smarter. You could put it on a menu item or buton for convenience:

Names Default To Here(1);
// Open a table to play with
dt = Open("$SAMPLE_DATA\Big Class.jmp");
// Open some windows in the session from this table (this would be done interactively)
ss = dt << Get Table Script Names;
for (s=1, s<=NItems(ss), s++, dt << runScript(ss[s]));
// Delete the saved scripts from the table
for (s=1, s<=NItems(ss), s++, dt << deleteTableProperty(ss[s]));
Wait(3);

// Start here . . .

// See the names of all the tables that are currently open in ths session
openTables = {};
for(t=1, t<=NTable(), t++, InsertInto(openTables, DataTable(t) << getName));

// See which windows are currently open in the session
openWindows = {};
for(w=1, w<=NItems(Window()), w++, InsertInto(openWindows, Window(w) << getWindowTitle));

// Handle each open table in turn
for(t=1, t<=NItems(openTables), t++,
	// Truncate the table name if required
	if(EndsWith(Uppercase(openTables[t]), ".JMP"), openTables[t] = Substr(openTables[t], 1, Length(openTables[t])-4));
	for(w=1, w<=NItems(openWindows), w++, 
		If(StartsWith(openWindows[w], openTables[t]),
			// This windows belongs to this table, so get the scriptable object
			so = Window(openWindows[w])[OutlineBox(1)] << getScriptableObject;
			// Save the script to the parent data table
			so << saveScriptToDataTable;
			// Close the window
			Window(openWindows[w]) << closeWindow;
			);
		)
	);
galactus3000
Level IV

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

Thank you. How would I go about making this a menu item?

ian_jmp
Level X

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

This part of the JMP 13 documentation explains how to add a menu item. If you are happy that the code above does what you want, just take the first line, and everything from 'Start here' onwards.

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

I use the "Save Sessions Script..." (File menu) as a way to quickly clear the session from hundreds of reports; for example if I need to reboot or temporarily work on a different project. I can later take off exactly where I left by running the script. All (saved) tables and reports are automatically opened and recreated. 

 

 

galactus3000
Level IV

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

Thank you ... I tried to use Projects, dragging tables and reports into a newly created project. Upon closing JMP and double-clickin on the project file saved in a Windows folder, the projects dialog comes up and requires me to choose a project to open (which I thought I already did by double-clicking on it in my Windows folder).

Did I do something wrong?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Easier way to exit jmp with multiple tables each having multiple graphs/analyses?

I did not mean JMP Projects, sorry for the confusion.  I have never really explored that functionality and can't be of much help.

 

I was more referring to a work task in general. Like when I'm in the middle of an analysis with the workspace cluttered with hundreds of "promising" reports, and suddenly I must shift focus to work in JMP with something of higher priotity. Then the Session Script comes in handy, allowing me to postpone difficult decisions about what analyses to save and which to discard. Save the script with an adequate name, close everything and turn to the more urgent task with a clean workspace. 

 

Later, I can return to the earlier state (of mind and workspace) by just opening and running the session script.