Hello,
Happy new year!
Is there a way to make the processing faster? I tried using it for each, and it did save some time. I'm trying to figure out if I can optimize using the Column formula
Here is my for loop. It takes a very long time to run over 1M iterations. Any advice?
Names Default To Here( 1 );
dt = Current Data Table();
start = Tick Seconds();
dt << Clear Row States;
dt << Clear Column Selection();
//Does Table Variable Exist?
var = dt << Get Table Variable( "YieldIteration" );
varnum = Num( var );
If( var == "",
dt << Set Table Variable( "YieldIteration", 1 ),
dt << Set Table Variable( "YieldIteration", varnum + 1 )
);
var = dt << Get Table Variable( "YieldIteration" );
varnum = Num( var );
dt << Clear Column Selection;
allcol = dt << get column names( string );
dt << select column group( "Tests" );
selcol = dt << get selected columns;
nselcol = N Items( selcol );
FUDDnum = Round( nselcol * 0.17 );
dt << Clear Column Selection();
// function to get spec limits
Spec = Function( {colno},
colspec = Column( colno ) << get property( "Spec Limits" );
lsl = colspec["LSL"];
usl = colspec["USL"];
L = Matrix( {lsl, usl} );
);
// set up pareto columns
PassCol = New Column( "PassFail" || var, Numeric, <<SET each="" value=""> L[2],
PassCol[jj] = 0;
If(
ParetoCol[jj] != ".", ParetoCol[jj] = ParetoCol[jj] || ", " || selcolchar,
ParetoCol[jj] == ".", ParetoCol[jj] = selcolchar
);
NumFail[jj] = NumFail[jj] + 1;
);
If( NumFail[jj] >= FUDDnum,
ParetoCol[jj] = "FUDD"
);
);
);
);
dt << end data update;
end2 = Tick Seconds();
runtimetoshow = end2 - start;
formated = Format( runtimetoshow, "min:s", 12 );
Caption( "Runtime: " || formated || "min" );</SET>Thanks.