Hi all,
I have this piece of code but I'm quite not sure if there is a more appropriate approach to this. My loop gets an error because some of the data table have multiple NBO values.
Data out of range at row 10 in access or evaluation of 'For Each' , For Each/*###*/({table}, dt_Test, table << New Column( "Ref" ) ; Wait( 0 ) ; table
:Ref[table << get rows where( :Lot == "NBO" & :N Rows == Col Max( :N Rows, :Lot ) )]
= 1)
So what I am trying to do is create an If statement inside the For Each loop. The IF statement will determine if NBO is has no duplicates on the Lot Column, if it has no duplicates, then it will put 1 on Ref column.
For Each( {table}, dt_Test,
table << New Column("Ref");
wait(0);
If (
//NBO has duplicate, deletes the NBO with lowest N Row value
dt_Test << Select duplicate rows(Match(:Lot)); //only selects the matching values, how can I delete the NBO with lowest N Rows count?
dt_Test << Delete Rows;
,
//if NBO has no duplicates,
table:Ref[table << get rows where( :Lot == "NBO" & :N Rows == col max(:N Rows, :Lot))]=1;
);
);