Hello JMP Community,
I am building a JSL script that allows the user to select multiple variables via checkboxes. The data is grouped via two columns "Type" and "Size". I have the first variable working so that when the user marks that check box and runs the script it creates a chart of that variable for each combination of type and size (e.g. if there are 5 types and 2 sizes I'll get 10 graphs each with its own outline box). The problem I'm running into is adding a second, third, etc variable. I am not sure how to add new charts without adding repeat outline boxes.
This is the code I have that creates the charts for the first variable.
New Window("Charts",
Platform(dt,
If(Checkbox1 == 1,
Control Chart(
Sample Label( :Date ),
Phase( :Machine ),
KSigma( 3 ),
Chart Col(:Variable1, Levey Jennings( Show Control Limits( 0 ))),
By( :Size, :Type )
)
)
)
The next line I added was this:
Platform(dt,
If(Checkbox2 == 1,
Control Chart(
Sample Label( :Date ),
Phase( :Machine ),
KSigma( 3 ),
Chart Col(:Variable2, Levey Jennings( Show Control Limits( 0 ))),
By( :Size, :Type )
)
)
)
);
Unfortunately this doubled the number of outline boxes I have rather than nesting similar combinations of Type and Size under the same outline box.
I noticed that when I hard code the following the script does what I want it to.
Platform(dt,
If(Checkbox1 == 1,
Control Chart(
Sample Label( :Date ),
Phase( :Machine ),
KSigma( 3 ),
Chart Col(:Variable1, Levey Jennings( Show Control Limits( 0 ))),
Chart Col(:Variable2, Levey Jennings( Show Control Limits( 0 ))),
By( :Size, :Type )
)
)
)
With this knowledge what I would like to do is create a variable for the Chart Col() lines. This variable will change depending on what check boxes are selected. The problem is I don't know what I need to assign to the variable and how I need to call it within the Control Chart command. I tried various combinations of expr, eval expr, and eval but none of that has worked.
Chart_Insert = Expr(Chart Col(:Variable2, Levey Jennings( Show Control Limits( 0 ))));
This seems to assign the expression to the variable correctly, but I couldn't figure out what combination of Eval Expr and Eval I needed in order to add it to the Control Chart command.
I apologize if this question is worded poorly. If any clarification is needed let me know. Also I don't know how to properly add code to a question so I'm sorry if the formatting gets messed up.
Thanks!