A customer asked how to create a JSL script to prompt other users to define the LSL and USL for each subset table.
I figured might as well post the script here to help others who might have the same request in the future. Anyone who has feedback, questions or enhancements, please feel free to add a comment.
// Subset data table
// → Data Table( "Product=B" )
dtList = Open("$SAMPLE_DATA/Abrasion.jmp")
<<Subset(
By(:Shift),
All rows,
Selected columns only(0)
);
Show(dtList);
For(i = 1, i <= N Items(dtList), i++,
dt = dtList[i];
// Run the script
Print(dtList[i]);
Wait(1);
ex = New Window("Defining Specification Limits",
<<Type("Modal Dialog"),
<<Return Result,
<<On Validate(
LSL_value = LSL_var << Get;
USL_value = USL_var << Get;
If(LSL_value < USL_value, // in range
USL_var << Background Color("Background"); // this field does not need attention
1; //the number is good, validate
, // else out of range
USL_var << Background Color("Light Yellow");
LSL_var << Background Color("Light Yellow"); // this field needs attention
0; // the number is bad, do not validate
) // the result of this if(...) is the OnValidate( ) answer, 0 or 1
),
Border Box(top(20), bottom(20), Left(20), Right(20),
V List Box(
Text Box("Enter a value for the LSL and USL in " || Char(dtList[i])),
H List Box(
V List Box(Text Box("LSL "), Text Box("USL ")),
V List Box(LSL_var = Number Edit Box(0), USL_var = Number Edit Box(1))
),
H List Box(Button Box("OK"), Button Box("Cancel"))
)
)
);
// the Modal window must be closed before the following code runs
If(
ex["button"] == 1 // not canceled
, // then show the value
Write(LSL_value);
Write(USL_value);
Print(LSL_value, USL_value)
;
,
Write("CANCEL"); // cancel button or red X was pressed
);
Wait(0.2);
Eval(
Eval Expr(
dt:Abrasion << Set Property(
"Spec Limits",
{LSL(Expr(LSL_value)), USL(Expr(USL_value)), Show Limits(0)}
);
)
);
Wait(1);
);