你好,
我试图迭代 X 和 Y 的每个值并将最大 rn 值保存在 MaxValue 列中。
这是我尝试过的,但有些东西似乎不正确。 有什么建议吗?
Names Default To Here( 1 );
// Assuming your data table is named 'dt'
dt = Current Data Table();
// Create a new column "MaxValue" and initialize with a large negative number
// Loop through unique Barcode values
// Loop through rows
dt << begin data table();
// Loop through rows
For( i = 1, i <= N Rows( dt ), i++,
currentBarcode = dt:Barcode[i];
// Find the location of the maximum rn value for the current Barcode
maxRNRow = Max( dt:rn[dt:Barcode[i] == currentBarcode] );
// Check if the maxRNRow is not 0 (meaning there is at least one matching Barcode)
If( maxRNRow != 0,
// Update "MaxValue" column with the max rn value for the current Barcode
dt:MaxValue[i] = dt:rn[maxRNRow]
);
);
dt << end data table();