Hi,
I am not sure what is wrong with my script. It is supposed to take the user input values of PQA (a categorical variable) and produce output scripts that contain customized One-way results for each PQA, using a subset data set to get the information needed to read into the scripts that are saved to the original data table. For example, when I run the following JMP code on the toy Data table with the script's user input window, I get an error message (see figures below).
JMP code:
/*
Objective:
Get a JMP report with customized comparability model output,
given a data table with column names:
- batch name/lot number
- Mfg Group
- PQA
- result
- measurment units
- LSL
- USL
The comparability output will give the process charts and the
TOST results.
*/
/////////////////////////////////////////////////////////////
//User Selection Menu(s)
/////////////////////////////////////////////////////////////
//select the data in the original data table
Names Default To Here( 1 );
dt = Current Data Table();
//get the unique PQAs
col9 = Column(dt, "PQA");
unique_pqa = Associative Array( col9 ) << get keys;
//Part 2: Select PQA(s) and invisibility option.
invisible_window_options = {"invisible", "visible"};
nw2 = New Window("Select PQAs",
<<MODAL></MODAL> variablebox1_pqa << Set All(this << Get, run script(1))))),
Text Box("Select All PQAs", <<SET width=""></SET> Is String(units), " (" || units || ") ");
//get the spec limits
lslval = :LSL[1];
uslval = :USL[1];
lpcrval = :Name("Lower_PCR")[1];
upcrval = :Name("Upper_PCR")[1];
//TO DO: write in the max_val and min_val from stability script to
//set the significance level based on the number of spec limits present
alpha_level_a = If(!Is Missing(lslval) & !Is Missing(uslval), 0.1, 0.2);
dt << New Script (
"JMP report results for " || pqa_val,
//TO DO: Wrap process chart and TOST results into an initalized window
//Process Chart
Oneway(
//SendToByGroup( {:PQA == Expr(pqa_val)},
//Y( :Result ) ),
Y( :Result N ),
X( :Name("Batch Name") ),
Connect Means( 1 ),
Grand Mean( 0 ),
//),
// SendToByGroup(
// {:PQA == pqa_val},
Where( :PQA == Expr(pqa_val) ),
SendToReport(
Dispatch(
{},
"Oneway Analysis of Result N By Batch Name",
OutlineBox,
{Set Title( "Oneway Analysis of " || Expr(pqa_val) || Expr(units_formatted) || " Result N By Batch Name")}
),
Dispatch(
{},
"Result N",
TextEditBox,
{Set Text( Expr(pqa_val) || Expr(units_formatted) )}
),
Dispatch(
{},
"2",
ScaleBox,
{Label Row( Set Font Size( 5 ) )}
),
Dispatch(
{},
"1",
ScaleBox,
{Min( Expr(lslval)*0.9 ), Max( Expr(uslval)*1.1 ), Inc( 1 ), Minor Ticks( 1 ),
Add Ref Line(
Expr(lslval),
"Solid",
"Dark Red",
"LSL (" || char(Expr(lslval)) || ")",
2
),
Add Ref Line(
Expr(uslval),
"Solid",
"Dark Red",
"USL (" || char(Expr(uslval)) || ")",
2
),
Add Ref Line(
Expr(lpcrval),
"Dashed",
"Dark Blue",
"Lower PCR Limit (" || char(Expr(lpcrval)) || ")",
2
),
Add Ref Line(
Expr(upcrval),
"Dashed",
"Dark Blue",
"Upper PCR Limit (" || char(Expr(upcrval)) || ")",
2
)
}
),
Dispatch(
{},
"Oneway Plot",
FrameBox,
{Frame Size( 1000, 300 ), DispatchSeg(
CustomStreamSeg( 6 ),
{Line Color( "Gray" )}
), Row Legend(
Group,
Color( 0 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
//) //send to by group
); //Process chart Oneway
//TOST results
Oneway(
Y( :Result N ),
X( :Group ),
t Test( 1 ),
Set α Level( Expr(alpha_level_a) ),
Where( :PQA == Expr(pqa_val) ),
SendToReport(
Dispatch(
{},
"Oneway Analysis of Result N By Group",
OutlineBox,
{Set Title( "Oneway Analysis of " || Expr(pqa_val) || Expr(units_formatted) || " Result N By Group" )}
),
Dispatch(
{},
"Result N",
TextEditBox,
{Set Text( Expr(pqa_val) || Expr(units_formatted) )}
))
); //TOST oneway
); //dt new script
) //eval expression
); //eval
//); //content V List box
//append each output into the initialized nw window above.
//container << Append(content);
); //for loopToy JMP dataset:

JMP User Input modal window

JMP error message: "Name Unresolved: units_formatted in access or evaluation of 'units_fortmatted',..."

Why is JMP not reading, for example, the Measurement units column from each PQA subset dataset listDT produced by each iteration of the for loop so that the measurement units for PQA = A is "%" and placed on the y-axis label of the chart as in the script?
Sorry and thanks for letting me know! I forget to out it up in my original posting as an attachment.
If you could attach a sample data table, it would be very helpful/