Ignore the original version of this reply. I'm going to go with the 'it was before my morning coffee excuse'.
Try this. A couple corrections. The s, lsl, usl were not stored in a list in previous posts so the values were stale. fixed here. I inadvertantly used the "N" as the iterating parameter instead of i. Fixed here. Definitely double check this is doing what you want.
//clear log();
namespace("here")<<remove(namespace("here")<<getkeys);
names default to here(1);
dt = current data table();
showErrorMsg = expr(New Window("Must select at least one column...",<<Modal, textBox("Must select at least one column in Y and X roles. "),
ButtonBox("OK")));
//grrFunction = Function({ylist, xlist, bbylist}, // pass GUI variables to locals here, downside is can't hover to observe values
grrFunction = Function({x}, // x not used here, just using the variables from the GUI and re-assinging to existing vars
ylist = yParamNames;
xlist = xParamNames;
bbylist = byParamNames;
N = N Items( ylist );
nwOutput = new window("Output",
vlb_out = vlistbox();
);
For( i = 1, i <= N, i++,
s = column(dt, ylist[i]) << Get Property( "Spec Limits" ); // note that I had a typo here, should be i, not N
usl = s["USL"];
lsl = s["LSL"];
//obj = Variability Chart(
vlb_out << append(
Variability Chart(
Y( Eval( ylist[i] ) ),
X( Eval( xlist ) ),
By( Eval( bbylist ) ),
Model( "Main Effect" ),
Max Iter( 100 ),
Conv Limit( 0.00000001 ),
Number Integration Abscissas( 128 ),
Number Function Evals( 65536 ),
Analysis Type( "Choose best analysis (EMS REML)" ),
Historical Mean( 0 ),
Historical Sigma( 0 ),
//Process Variation( 0 ),
Std Dev Chart( 0 ),
Gauge RR( 5, usl - lsl, lsl, usl );
)//;
)
);
// obj << Gauge RR( 5, usl - lsl, lsl, usl );
);
nw = new window("Select Columns For Gauge R&R Analysis",
hlistbox( // horizontal list box
cflObj = filter col selector(data table(dt << get name()), nlines(20)), //first item in hlist box
panelbox( "Cast selected columns into roles", // second item
lineupbox(ncol(2),
bb_y = buttonbox("Y, Response",
newParams = cflObj << get selected;
yColObj << append(newParams);
),
yColObj = col list box(data table(dt << get name()),numeric,nlines(5), min items(1)),
bb_x = buttonbox("X, Factor",
newParams = cflObj << get selected;
xColObj << append(newParams);
),
xColObj = col list box(data table(dt << get name()),nlines(3), min items(1), <<Set Analysis Type(Nominal)),
bb_by = buttonbox("By",
newParams = cflObj << get selected;
byColObj << append(newParams);
),
byColObj = col list box(data table(dt << get name()),nlines(3))
)// end lineupbox
)// end roles panel box
,
panelbox("Actions", // final item
vlistbox(
button box("Ok",
yParamNames = yColObj << get items;
xParamNames = xColObj << get items;
byParamNames = byColObj << get items;
if ( nitems(yParamNames) == 0 | nitems(xParamNames) == 0 ,
showErrorMsg
,
//else
new namespace("recall_grr");
recall_grr:yParamNames_rcl = yColObj << get items;
recall_grr:xParamNames_rcl = xColObj << get items;
recall_grr:byParamNames_rcl = byColObj << get items;
nw << close window;
//grrFunction(yParamNames, xParamNames, byParamNames) //pass to local
grrFunction(1) // use these 3 (above) vars directly without passing
);
),
button box("Remove", yColObj << remove selected; xColObj << remove selected; byColObj << remove selected),
button box("Cancel", nw << close window),
spacerbox(Size(1,80)),
button box("Recall",
try(yColObj << append(recall_grr:yParamNames_rcl));
try(xColObj << append(recall_grr:xParamNames_rcl));
try(byColObj << append(recall_grr:byParamNames_rcl));
)
)
)//end actions panel box
) // end hlistbox
);//end new window nw