[JMP Pro 14.1.0, OS W7 64-bit]
Dear All,
I am working on automating a data table for some customers. The data table contains a date column and several product property columns, all with spec limits.
One of the things I'm trying to do is add to the data table new scripts so the customer can easily click the green hot button in the data table and get the control chart for whichever property they're interested in.
I have a list called "SpecList" that contains all the column names in the data table, and I have a spec data table with the usual _LSL, _USL, and _Target columns names that are needed for the "manage spec limits" tool for quality and process control.
I'd like to generate the new scripts with a For loop within the New Script function -- that's the concept at least. An example of what I'd like to send to the table is below, where I'd like the [1] to eventually be an [i] in a For loop:
dtperf << New Script(
"Control Chart " || SpecList[1],
Control Chart Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Variables( Subgroup( :Date ), Y( Column(dtperf, SpecList[1]) ) ),
Chart( Position( 1 ), Limits ),
Chart( Position( 2 ), Limits ),
SendToReport(
Dispatch(
{},
SpecList[1],
ScaleBox,
{Add Ref Line( dtspecs:Name( "_LSL" )[1], "Solid", "Blue", "LSL", 1 ), Add Ref Line(
dtspecs:Name( "_USL" )[1],
"Solid",
"Blue",
"USL",
1
), Add Ref Line( dtspecs:Name( "_Target" )[1], "Solid", "Blue", "USL", 1 )}
)
)
)
);
Parts of it work as I intend, others don't. The name of the new script works as you would expect. I'm having trouble, particularly with the Dispatch portion. After "Dispatch( {} , SpecList[1],....". and with the Add Ref Line() sections.
The Dispatch SpecList[1] literally sends SpecList[1] instead of inserting the text from the list. Then, in the Add Ref Line portion, it also literally sends dtspecs:Name("_LSL")[1] instead of the value from the data table. The script that is saved to the data table is below:
Control Chart Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Variables( Subgroup( :Date ), Y( Column(dtperf, SpecList[1]) ) ),
Chart( Position( 1 ), Limits ),
Chart( Position( 2 ), Limits ),
SendToReport(
Dispatch(
{},
SpecList[1],
ScaleBox,
{Add Ref Line( dtspecs:_LSL[1], "Solid", "Blue", "LSL", 1 ),
Add Ref Line( dtspecs:_USL[1], "Solid", "Blue", "USL", 1 ),
Add Ref Line( dtspecs:_Target[1], "Solid", "Blue", "USL", 1 )}
)
)
)
I've tried Char(), Num(), Try(), and Eval() wrapped around the sections of relevant code to see if it would work, but it doesn't.
Also, the Y column in the Variables doesn't work. It again sends exactly that which is written instead of the reference it's pointing to. However, when I highlight the Control Chart Builder function in my original script above (first script), it works just fine.
I'd like a way to solve this so it sends the actual values referenced to the new script instead of the literal JSL script. The reason is that I'm trying to write the script as generic as possible so it can be applied to other products and one doesn't need to dig too deep into the script to modify/update in order to roll it out for the other products.
I think part of the problem is that my variable names all live in my primary script (I set names default to here(1)), and when it sends a new script to the data table, it doesn't know how to evaluate a reference to a variable that isn't defined. I might need to send these variables to the script being written to the data table, but I'm not sure how. I'd prefer not to generate a global variable either.
Thanks!,
DS