cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
shlomi_bakish
Level II

setting spec limit to column property by JSL - lines not shown on plot

Hi

 

I have a script that assigns spec limits (USL/LSL) to columns property, and then make a plot of the column, and I expect
to see the limits lines drawn on the plot. What happens is that the limits are set correctly in the table, but not visible on the plot.

If I draw the same plot to this column manually after running the script - no lines again.

If I open the column spec property window, I see the limits, the 'show reference line' is on.
only if I hit 'Apply' and then plot again - I can see the lines on the plot as expected. But I can't get it to work by script..

any idea?

(using JMP PRO 15)

 

shlomi_bakish_0-1644497880045.png

shlomi_bakish_1-1644497971080.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

Syntax seems to be slightly off, you have to add {} after Spec Limits. See below script, weight wont work without pressing apply and height will.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, "weight") << Set Property("Spec Limits", LSL(50), USL(150), Show Limits(1));
Column(dt, "height") << Set Property("Spec Limits", {LSL(50), USL(100), Show Limits(1)});

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height)),
	Elements(Points(X, Y, Legend(4)), Smoother(X, Y, Legend(5)))
);
-Jarmo

View solution in original post

11 REPLIES 11
SDF1
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

Hi @shlomi_bakish ,

 

  Can you provide an example of your JSL code? This might help to diagnose the issue you are having. In the meantime, this portion of code is an example of how you can set the spec limits for the columns and ensure that they are turned on for graphing.

//Turn on spec lines for graphs
dt = Current Data Table( ); //just a way of setting the current data table to the variable dt

dt_ColNames = dt << Get Column Names( string ); //Gets the column names from the data table
For( i = 1, i <= N Items( dt_ColNames ), i++,
spec = Column( dt, dt_ColNames[i] ) << Get Property( "Spec Limits" ); //This gets the Boolean spec property of each column
//now, for each column perform the task of assigning the spec limits
If( Is Empty( spec ) == 0, LSL = Try( spec["LSL"], . ); USL = Try( spec["USL"], . ); Target = Try( spec["Target"], . ); Eval( Substitute( Expr( Column( dt, dt_ColNames[i] ) << Set Property( "Spec Limits", {LSL( __LSL__ ), USL( __USL__ ), Target( __Target__ ), Show Limits( 1 )} ), ), Expr( __LSL__ ), LSL, Expr( __USL__ ), USL, Expr( __Target__ ), Target ) );//This whole Eval() is wrapping a Substitution(), which wraps an expression Expr().
//The variables that will be substituted are __LSL__ and so on. The Show Limits (1) checks the box to turn on the limits as reference lines. ); );

  This should help get you going in the right direction. But, without seeing your code and understanding what you're doing, it's hard to be more specific to address your exact need.

 

Hope this helps!,

DS

shlomi_bakish
Level II

Re: setting spec limit to column property by JSL - lines not shown on plot

thanks for the prompt reply ! I assumed the code is not really relevant, since it does get the spec limits set correctly in the column properties.

it sets LSL and USL and show Limits (1), but the plot doesn't show them even though they are set correctly.

Even if I use a straight forward code with fixed numbers, it behaves the same..

Column(DATA_DT,param) << Set Property( "Spec Limits", LSL( 0.31 ),USL(0.34),Show Limits(1) );

shlomi_bakish_0-1644499816390.png

Only after hitting 'apply' and drawing the graph again - it shows the lines.

jthi
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

Syntax seems to be slightly off, you have to add {} after Spec Limits. See below script, weight wont work without pressing apply and height will.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

Column(dt, "weight") << Set Property("Spec Limits", LSL(50), USL(150), Show Limits(1));
Column(dt, "height") << Set Property("Spec Limits", {LSL(50), USL(100), Show Limits(1)});

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height)),
	Elements(Points(X, Y, Legend(4)), Smoother(X, Y, Legend(5)))
);
-Jarmo
shlomi_bakish
Level II

Re: setting spec limit to column property by JSL - lines not shown on plot

Thanks ! indeed adding the curly braces solved the problem

Can you explain why is 

jthi
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

I'm not sure why it behaves like that without the curly braces because using them seems to be the correct syntax JMP Help - Column Properties 

col << Set Property( "propertyName", {argument list} );

JMP must be saving some information internally, because if you run the command WITHOUT curly braces and check out column properties, it looks just fine but if you use Copy Column Properties you get just the first argument (because you don't have a list of arguments):

Add Column Properties(
	Set Property("Notes", "Explore data adventurously"),
	Set Property("Spec Limits", LSL(50))
)

Then after pressing Apply in the Spec Limits column property, the arguments get updated to correct list:

Add Column Properties(
	Set Property("Notes", "Explore data adventurously"),
	Set Property("Spec Limits", {LSL(50), USL(150), Show Limits(1)})
)
-Jarmo
txnelson
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

It appears that you are applying the limits after the chart is initially displayed.  The limits are drawn when the chart is initially displayed, and if limits are added after that point, the chart will have to be redrawn to get them to display.

Jim
chris_dennis
Level III

Re: setting spec limit to column property by JSL - lines not shown on plot

I use a very similar method to take limits from a limits table to add spec limits to the column properties.  I wanted to try and use similar method to update units based on value in the limits table.  Currently commented out in code show, but when I run I get a value of "List" as the unit property instead of the unit desired.  I think this is syntax issue, but so far have not found correct syntax for the eval expr statement.

 

txnelson
Super User

Re: setting spec limit to column property by JSL - lines not shown on plot

Here is a simple example that works using your code.  If it still isn't working on your data tables, look for inconsistencies with the column names

Names Default To Here( 1 );
res_thk_specs = New Table( "thelookup",
	Add Rows( 2 ),
	New Column( "UOM",
		Character,
		"Nominal",
		Set Values( {"inches", "lbs"} ),
		Set Display Width( 48 )
	),
	New Column( "TARGET",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [60, 115] )
	),
	New Column( "USL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [70, 172] )
	),
	New Column( "LSL",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [50, 60] ),
		Set Display Width( 89 )
	),
	New Column( "colname",
		Character,
		"Nominal",
		Set Values( {"height", "weight"} ),
		Set Display Width( 0 )
	)
);
res_thk_data = New Table( "thedata",
	Add Rows( 5 ),
	New Column( "height",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 5, 0 ),
		Set Values( [59, 61, 55, 66, 52] )
	),
	New Column( "weight",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 5, 0 ),
		Set Selected,
		Set Values( [95, 123, 74, 145, 64] )
	)
);

// Your code
datacolnames = res_thk_specs:colname << get values;
specExpr = Expr(
	Column( Res_Thk_Data, name ) <<
	Set Property(
		"Spec Limits",
		{LSL( Expr( lower ) ), USL( Expr( upper ) ),
		TARGET( Expr( target ) ), Show Limits( 1 )}
	)
);
			//unitExpr = Expr(
//	column ( Res_Thk_Data, name ) << Set Property(
//		"Units", { _unit_ } 
//	)
//);	
				
For( i = 1, i <= N Rows( RES_THK_SPECS ), i++,
	name = Column( RES_THK_SPECS, "COLNAME" )[i];
	lower = Column( RES_THK_SPECS, "LSL" )[i];
	upper = Column( RES_THK_SPECS, "USL" )[i];
	target = Column( RES_THK_SPECS, "TARGET" )[i];
	_unit_ = Column( RES_THK_SPECS, "UOM" )[i];
				
	If( Contains( datacolnames, name ),
		Eval( Eval Expr( specExpr ) )
	);
			//	If( Contains( datacolnames, name ),
	//		Eval( Eval Expr( unitExpr ) ) 
	//	);
);
Jim
chris_dennis
Level III

Re: setting spec limit to column property by JSL - lines not shown on plot

Jim, Thanks for the response.  I ran and limits are added to the table.  The part I am having issue with is adding units to the column properties.  When I remove the comments from my code the units column property does get filled, but not with the desired value of inches or lbs.  Instead both get filled with value of List.  Not clear to me what I am missing in the expression statement or evaluation statement to transfer the text from the data table cell.  Any help would be

appreciated.