Hello,
I try to use the "For each row" and "Begin Data Update" script commands to update the calculation on specific row related to a column.
According to the table below, I intend to have two addition columns, Defective Rate (%) and Yield, and they both use the same equation of cell qty/daily total.
However, Defective Rate (%) column will only calculate the rows where Category = Reject & MRB, and Yield column will only calculate the rows where Category=Binned.
I can get this work out using IF command like
dt=Current data table();
dt<< New Column("Defective Rate(%)", Numeric, "Continuous", Formula(Name Expr(If(:Category == "Reject", "MRB" ,:Cell Qty/:Daily Total))));
However, I try to learn how to use the For each row combined with Begin Data Update to reach the same result.
dt<< New Column("Yield", Numeric, "Continuous");
<< Begin data update;
For each Row( :Yield_ = Selected(Row State())=Contains(:Category,"Binned"), :Cell Qty/:Daily Total)
Can anyone help out?
Thanks,
Category | WorkWeek | Date_PROD. | Cell Qty | Daily Total | Defective Rate(%) | Yield |
| Reject | 25 | 2016-06-20 | 751 | 15553 | | |
| MRB | 25 | 2016-06-20 | 21 | 15553 | 0.00135022 | |
| Binned | 25 | 2016-06-20 | 14781 | 15553 | 0.95036327 | 0.95036327 |
| Reject | 25 | 2016-06-21 | 1251 | 31586 | | |
| MRB | 25 | 2016-06-21 | 83 | 31586 | 0.00262775 | |
| Binned | 25 | 2016-06-21 | 30252 | 31586 | 0.9577661 | 0.9577661 |
| Reject | 25 | 2016-06-22 | 1276 | 27964 | | |
| MRB | 25 | 2016-06-22 | 42 | 27964 | 0.00150193 | |
| Binned | 25 | 2016-06-22 | 26646 | 27964 | 0.95286797 | 0.95286797 |
| Reject | 25 | 2016-06-23 | 126 | 1786 | | |
| MRB | 25 | 2016-06-23 | 5 | 1786 | 0.00279955 | |
| Binned | 25 | 2016-06-23 | 1655 | 1786 | 0.92665174 | 0.92665174 |