Subscribe Bookmark RSS Feed

Update script-analysis and graphs based on inputs from "New Window"

samir

Community Trekker

Joined:

May 20, 2016

Hello,

I am triying to write a script that interactively is re-run based on varying values provided by a "New window".

Here is the scheme:

1/ I open a window that has a button ("Select Master File").

2/ When I click on this button, a "pick File" is launched, and I select a file

3/ based on the content of the selected file, I should run a script and generate graphs

Here are my questions:

1/ How to make sur each time I select a new file, the whole script is re-run and graphs are updated ?

2/ How to get the graphs embedded in the "New window" where I select the file ?

3/ The script I have to run is rather long and several graphs have to be generated. Is there a way to call this script without putting all the code in the "New window" code ? (like calling a function or so,...)

 

Thanks a lot.

Find below a simplified version of the code (with 2 files attached to test the code):

 

// Collect location of the Master file and the data...
New Window( "Window Controls",
	Lineup Box( N Col( 1 ), Spacing( 3 ),
		Panel Box( "1/ Select location of Data...", Button Box( "Select Data", Folder = Pick Directory( "Please pick a folder", ShowFiles ) ) ),
		Panel Box( "2/ Select Data Master File...", g1=Button Box( "Select Master File", MasterFile = Pick File() 
)  ),
		Col List Box( all ); //g1 << updateWindow;
	),


);


MasterTable = Open( MasterFile );

Lots = Column( MasterTable, "Lot" ) << GetAsMatrix;
Factors = Column( MasterTable, "Factor" ) << GetAsMatrix;

x = Factors * [10, 50, 90];
y = Factors * [10, 90, 10];
New Window( "Poly Seg Example", g = Graph Box( Poly Seg( x, y ) ) );

 

 

2 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

Here's one way to save the graphs as an expression, and then use it later in the new window.

dt = open("$sample_data\Big Class.jmp");

g1_expr = expr(
	gb1 = dt << Graph Builder(Show Control Panel( 0 ),
		Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
		Elements( Points( X, Y, Legend( 6 ) ) )
	);
);

g2_expr = expr(
	gb2 = dt << Graph Builder(Show Control Panel( 0 ),
		Variables( X( :age ) ),
		Elements( Pie( X, Legend( 3 ), Label( "Label by Value" ) ) ),
		SendToReport( Dispatch( {}, "Y title", TextEditBox, {Set Wrap( 2 )} ) )
	);
);

nw = new window("Sample Graphs",
	hlistbox(
		g1_expr,
		g2_expr
	),
);
samir

Community Trekker

Joined:

May 20, 2016

That solves perfectly the item 3/.

Many thanks !!!!!!!!!

Any idea on how to solve 1/ and 2/ ?