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

Objects reference in jmp scripts

Hello JMP community,

 

I have a question regarding objects reference in jmp scripts. The below code runs (JMP pro 17.2), but the process screening pops out in a different window, not in the Make_Win function, where the button is also placed. I know that if I would copy paste the 

PS = dt << Process Screening(...); part inside the V List Box then the behavior becomes as expected, but then the code becomes less readable and more cluttered.

 

Is there a way to define PS somewhere else and only include its reference inside the function (as shown in the example below), or how else would you make the code below work as intended.

 

Cols = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1", "PNP4", "NPN3", "IVP2", "NPN4", "SIT1", "INM1", "INM2",
"VPM1", "VPM2"};
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

	PS = dt << Process Screening(
		Y( Eval(Cols)),
		Control Chart Type( "Indiv and MR" ),
		Minimum Process Length( 1 ),
		Use Medians instead of Means( 1 ),
		Show tests( 0 ),
		Test 1( 0 ),
		Cp( 1 ),
		Spec Limits( 1 ), 
	);
	
	Make_Win = Expr( 
		New Window( "ProcessScreening", 
			Vlist_box = V List Box(
				PS,
				MyButton = Button Box( "SelectedRows", SendRows ),
			),
		),
	);

	SendRows = Expr(
		print_cols = Report( PS )[Table Box( 1 )][String Col Box( 1 )] << getselectedrows();
		Print( Report( PS )[Table Box( 1 )][String Col Box( 1 )][print_cols] );
	);

	Make_Win();

Thanks,

JNS.

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Objects reference in jmp scripts

There are many different options on doing this, here is one

Names Default To Here(1);

Cols = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1", "PNP4", "NPN3", "IVP2", "NPN4", "SIT1", "INM1", "INM2",
"VPM1", "VPM2"};

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

ps_collector = V List Box(
	PS = dt << Process Screening(
		Y(Eval(Cols)),
		Control Chart Type("Indiv and MR"),
		Minimum Process Length(1),
		Use Medians instead of Means(1),
		Show tests(0),
		Test 1(0),
		Cp(1),
		Spec Limits(1),

	)
);
	
SendRows = Expr(
	print_cols = Report(PS)[Table Box(1)][String Col Box(1)] << getselectedrows();
	Print(Report(PS)[Table Box(1)][String Col Box(1)][print_cols]);
);
	
nw = New Window("ProcessScreening", Vlist_box = V List Box(ps_collector),
	Button Box("OK", sendrows);
);
-Jarmo

View solution in original post

Craige_Hales
Super User

Re: Objects reference in jmp scripts

You want to use the platform(...) function.

Scripting Index is in the Help menuScripting Index is in the Help menu

When a platform launches, it will attach itself to a new window if it is being created within the new window construction, or a displaybox if is is being created within a displaybox construction. Otherwise it creates a new window. The platform() function returns the root displaybox without attaching it to anything. In the past I've also recommended using a borderbox wrapper around the dt<<processScreening, but I think platform() is better.

 

The scripting index example would make more sense like this:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p=Platform(
			dt,
			Bubble Plot(
				X( :weight ),
				Y( :age ),
				Sizes( :height ),
				Title Position( 0, 0 )
			)
		);
New Window( "Platform example",
	H List Box(
		Platform(
			dt,
			Bubble Plot(
				X( :weight ),
				Y( :height ),
				Sizes( :age ),
				Title Position( 0, 0 )
			)
		),
		p
	)
);
Craige

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Objects reference in jmp scripts

There are many different options on doing this, here is one

Names Default To Here(1);

Cols = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1", "PNP4", "NPN3", "IVP2", "NPN4", "SIT1", "INM1", "INM2",
"VPM1", "VPM2"};

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

ps_collector = V List Box(
	PS = dt << Process Screening(
		Y(Eval(Cols)),
		Control Chart Type("Indiv and MR"),
		Minimum Process Length(1),
		Use Medians instead of Means(1),
		Show tests(0),
		Test 1(0),
		Cp(1),
		Spec Limits(1),

	)
);
	
SendRows = Expr(
	print_cols = Report(PS)[Table Box(1)][String Col Box(1)] << getselectedrows();
	Print(Report(PS)[Table Box(1)][String Col Box(1)][print_cols]);
);
	
nw = New Window("ProcessScreening", Vlist_box = V List Box(ps_collector),
	Button Box("OK", sendrows);
);
-Jarmo
Craige_Hales
Super User

Re: Objects reference in jmp scripts

You want to use the platform(...) function.

Scripting Index is in the Help menuScripting Index is in the Help menu

When a platform launches, it will attach itself to a new window if it is being created within the new window construction, or a displaybox if is is being created within a displaybox construction. Otherwise it creates a new window. The platform() function returns the root displaybox without attaching it to anything. In the past I've also recommended using a borderbox wrapper around the dt<<processScreening, but I think platform() is better.

 

The scripting index example would make more sense like this:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p=Platform(
			dt,
			Bubble Plot(
				X( :weight ),
				Y( :age ),
				Sizes( :height ),
				Title Position( 0, 0 )
			)
		);
New Window( "Platform example",
	H List Box(
		Platform(
			dt,
			Bubble Plot(
				X( :weight ),
				Y( :height ),
				Sizes( :age ),
				Title Position( 0, 0 )
			)
		),
		p
	)
);
Craige