Scrambled control limits from a reference fileMy script was functioning fine before I added a new phase with updated limits to the control limits file. Now the limits are scrambled. I've quadruple checked the control limits file to make sure they are in the correct order. Any idea what could be causing the mix-up? I am experiencing this same issue across multiple product charts. I've tried assigning Value Ordering and turning on Row Order Levels, neither have worked.
dt_limits = Open( "R:\Research\PS5\Control_Limits\PMC013\PMC013 Metrology CLs Review.jmp" );
dt_limits << Sort( By( :Quarter ), Order( Ascending ), Replace Table );
dt = Open( "R:\Research\PS5\Control_Limits\JMP SPC files\PMC013 SPC Charts.jmp" );
In the attached picture, the limits for phase "4 2015" belong to phase "3 2018"

Re: Scrambled control limits from a reference fileI have tried both of your solutions. The second solution created a chart with JMP created limits instead of using the limits file. The summarize designation didn't make a noticable difference.
I've "fixed" this issue in other charts by either assigning/removing value ordering and/or row order levels, but this one still remains scrambled.
Going line by line, the limits are applied in the order: 1, 1 2016, 2 2015, 2 2017, and so on.
Re: Scrambled control limits from a reference fileYour code looks good. If a Metrology[i] had one or more missing quarters the For j counting loop could be off.
Have you used the debugger?
The only changes I might make is to specify the table x for summarize
summarize( yTables[i], phaselevels=By(:Quarter) )
Also instead of counting the phaselimits in the "For j -loop", I might use code to match the limits,
dt_limits << Sort( By( :Quarter, :_LimitsKey ), Order( Ascending, Ascending ), Replace Table );
//other code not shown
For( j = 1, j <= N Items( phaseLevels ), j++,
km = dt_limits << get rows where(:Quarter == phaseLevels[j] & :_LimitsKey=="_Mean");
kl = dt_limits << get rows where(:Quarter == phaseLevels[j] & :_LimitsKey=="_LCL");
ku = dt_limits << get rows where(:Quarter == phaseLevels[j] & :_LimitsKey=="_UCL");
ks = dt_limits << get rows where(:Quarter == phaseLevels[j] & :_LimitsKey=="_Std Dev");
Insert Into(
imExpr,
Eval Expr(
Phase Level(
Expr( phaseLevels[j] ),
Sigma( Expr( sigma[ks] ) ),
Avg( Expr( avg[km] ) ),
LCL( Expr( lcl[kl] ) ),
UCL( Expr( ucl[ku] ) )
)
)
)
);Hope that helps.
Re: Scrambled control limits from a reference fileHere's the full script minus the row marking at the beginning:
dt_limits = Open( "R:\Research\PS5\Control_Limits\PMC013\PMC013 Metrology CLs Review.jmp" );
dt_limits << Sort( By( :Quarter ), Order( Ascending ), Replace Table );
dt = Open( "R:\Research\PS5\Control_Limits\JMP SPC files\PMC013 SPC Charts.jmp" );
Metrology = dt_limits << get column names( numeric, continuous, string );
yTables = {};
rpt = New Window( "SPC",
<<ONCLOSE></ONCLOSE>
The samples are labeled by lot number. The entire table is sorted in ascending order by Quarter and then Lot Number before the above script is ran. I've attached a picture of the control limits file.

The only sort options I have are ascending and descending, unless I'm missing something.
Re: Scrambled control limits from a reference fileAre you using a variable for the Sample Label? What is it? The sort order (Quarter) looks like Quarter Year, which is not chronilogical but alphabetical. Is this the order you wanted?
Sorry without a view of the sorted limits file and the script (save script from the control chart), all I can do is speculate.