Hi,
I am trying to iterate over each values of X and Y and save the max rn value in the MaxValue column.
Here is what I tried but something doesn't seem correct. Any advice?
Names Default To Here( 1 );
dt = Current Data Table();
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();
![Jackie__0-1702402546406.png Jackie__0-1702402546406.png](https://community.jmp.com/t5/image/serverpage/image-id/59562i076EC5849F89FEE6/image-size/medium?v=v2&px=400)