@jthi Thanks. I have adapted your script to use with a dataset matching closely to mine. It works fine for one column name but not when I loop over column names. Also, how do I place each newly created column beside (on the right of) the column on which the operation is performed within the loop?
Names Default To Here( 1 );
Clear Log();
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
col_names = dt << Get Column Group( "Processes" );
ps = dt << Process Screening(
Process Variables( Eval( col_names ) ),
Spec Limits Dialog( "No (skip columns with no spec limits)" ),
);
ps << Color Out Of Spec Values (1);
t = ps << Get Window Title; //Show( t );
ps << Close Window;
dt << Clear Select << Clear Column Selection;
get_colored_cells = Function({dt, colname}, {Default Local},
colscript = Column(dt, colname) << Get Script;
l = Substitute(Name Expr(colscript), Expr(New Column()), List());
colored_cells = {};
Try(
colors = l["Color Cells"];
If(Type(colors[1]) == "List",
jmptrickery = 1;
,
jmptrickery = 0;
);
For Each({color}, colors,
If(jmptrickery,
Insert Into(colored_cells, color[2]);
,
Insert Into(colored_cells, color);
);
);
);
return(Matrix(colored_cells));
);
measColNames = dt << get column names(Numeric,Continuous ); show (measColNames[1]);
For( i = 1, i <= N Items( measColNames), i++,
rows = J( 1, N Rows( dt ), 0 );
colored_rows = get_colored_cells( dt, measColNames[i]);
rows[colored_rows] = 1;
dt << New Column( "PassFail"||measColNames[i], Numeric, Nominal, Values( rows ) );
);
//colname = "NPN1";
///// for single column
/*rows = J(1, N Rows(dt), 0);
colored_rows = get_colored_cells(dt, colname);
rows[colored_rows] = 1;
dt << New Column("result", Numeric, Nominal, Values(rows));*/
When it's too good to be true, it's neither