Is this what you want
names default to here(1);
dt = current data table();
colNamesX = dt << get column names(string);
for(i=nitems(colNamesX),i>=1,i--,
if(contains(colNamesX[i],"Flange")==0,
remove from(colNamesX,i,1),
word(4,colNamesX[i],"-.")!="",
remove from(colNamesX,i,1)
)
);
colNameColor = column(1)<<get name;
theExpr =
"gb = dt << Graph Builder(
Size( 534, 464 ),
Show Control Panel( 0 ),
Variables(";
for each( {col,index}, colNamesX,
theExpr = theExpr ||
"X( :\!"" || col || "\!"n, Position( 1 ) ),";
);
theExpr = theExpr ||
"Color( :\!"" || colNameColor || "\!"n )
),
Elements(
Box Plot(";
for each( {col,index}, colNamesX,
theExpr = theExpr ||
"X( " || char(index) || " ),";
);
theExpr = theExpr ||
"Legend( 3 )
),
Points(";
for each( {col,index}, colNamesX,
theExpr = theExpr ||
"X( " || char(index) || " ),";
);
theExpr = theExpr ||
"Legend( 4 )
)
)
);";
// Generate the graph
eval(parse(theExpr));
// Add the USL line
// Find the USL row
theUSLRow = (dt << get rows where(:Phase == "USL"))[1];
// Get the values
USLs = [];
For Each( {col}, colNamesX,
USLs = USLs || matrix(as column(dt,col)[theUSLRow])
);
// Set the Y axis upper value
report( gb )[AxisBox(2)] << Max(max(USLs)+.1*(max(USLs)-(report( gb )[AxisBox(2)] << get min)));
report( gb )[FrameBox(1)] << Add Graphics Script(
Pen Color( "red");
Pen Size( 2 );
Line Style( "DashDot");
matX = [];
For(i=0,i<=length(USLs)-1,i++,
matX = matX || matrix(i-.5) || matrix( i+.5);
);
matY = [];
For(i=1,i<=length(USLs),i++,
matY = matY || USLs[i] || USLs[i];
);
Line(matX,matY);
Text Color( "red" );
textPos = {0};
insert into(textPos,Max(max(USLs)+.025*(max(USLs)-(report( gb )[AxisBox(2)] << get min))));
Text( Center Justified, eval(textPos), "USL" );
);
Jim