cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
ar2
ar2
Level III

Script For Adding Spec Limits to a column

I am new to scripting

I am sure this is very straightforward, but I am looking to create a script that adds an upper spec limit to a column (No USL or Target required)

Many thanks for any guidance

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Script For Adding Spec Limits to a column

Here's one way:

NamesDefaultToHere(1);

// ******************************************************************************************
// Given a column reference, sets spec liomits property
// ******************************************************************************************
SetSpecLimits = function({c, lsl, usl, tar},
     cmd = Expr(c << SetProperty("Spec Limits", {LSL(expr(lsl)), USL(expr(usl)), Target(expr(tar))}));
     eval(evalexpr(cmd));
);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
SetSpecLimits(Column(dt, "height"), 60, ., .);		// Set LSL only
SetSpecLimits(Column(dt, "weight"), 80, 120, 100);	// Set all three values

 Use 'Help > Scripting INdex' and 'Help > Books > Scripting Guide' to help figure out how it works.

View solution in original post

5 REPLIES 5
ian_jmp
Level X

Re: Script For Adding Spec Limits to a column

Here's one way:

NamesDefaultToHere(1);

// ******************************************************************************************
// Given a column reference, sets spec liomits property
// ******************************************************************************************
SetSpecLimits = function({c, lsl, usl, tar},
     cmd = Expr(c << SetProperty("Spec Limits", {LSL(expr(lsl)), USL(expr(usl)), Target(expr(tar))}));
     eval(evalexpr(cmd));
);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
SetSpecLimits(Column(dt, "height"), 60, ., .);		// Set LSL only
SetSpecLimits(Column(dt, "weight"), 80, 120, 100);	// Set all three values

 Use 'Help > Scripting INdex' and 'Help > Books > Scripting Guide' to help figure out how it works.

ar2
ar2
Level III

Re: Script For Adding Spec Limits to a column

Thanks Ian...I'll give it a go

 

Andrew

deveshchugh
Level III

Re: Script For Adding Spec Limits to a column

Hi Ian,

Is there a way to add LSL/USL based on grouping by a second column. For ex: have different LSL/USL based on whether student is boy or girl. So, when we plot weight age/weight by either boy or girl, the corresponding limits should be displayed on chart (LSL/USL only). if we plot the boy and girl height in  one plot, the limit label could add _"groupby name" to the limit (ex: LSL_boy, USL_boy, LSL_girl, USL_girl). 

Thanks,

Devesh

deveshchugh
Level III

Re: Script For Adding Spec Limits to a column

Also, is there a way to rename to either LSL/USL to display some other name?

txnelson
Super User

Re: Script For Adding Spec Limits to a column

You can not change the LSL and USL labels.  You can load the limits as Response Limits, and it will label them RSL and LSL.  Finally, you can add you own Reference Lines which will allow you to name them whatever you want.

Jim