Hello experts,
I am sorry about the title. It might not be the best title to describe what I am looking for...
I am actually trying to create a code that will loop through orders (order lines) and check the codes next to each order number.
If all the lines of code next to each order are ZERO - the "mark" of ALL the lines of the order will be OK.
There might be several identical order lines (order number wise) and the codes next to each order number might be the same.
If even ONE of the codes next to each order line is NOT zero - the "mark" for ALL the SAME orders will be "NOT OK".
The database is sorted by order number and then by code (in real life there are a few thousands of lines)
Any idea what will be the best approach to achieve the "mark"?
TIA
Sample database:
[TABLE="width: 208"]
<tbody>[TR]
[TD="align: left"]Order [/TD]
[TD][/TD]
[TD]Code[/TD]
[TD][/TD]
[TD="align: left"]Mark[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010725[/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]011551[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]011567[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]B[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]Z[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 142"]
<tbody>[TR]
[TD="align: left"][/TD]
[TD][/TD]
[TD="align: left"][/TD]
[/TR]
</tbody>[/TABLE]
I am sorry about the title. It might not be the best title to describe what I am looking for...
I am actually trying to create a code that will loop through orders (order lines) and check the codes next to each order number.
If all the lines of code next to each order are ZERO - the "mark" of ALL the lines of the order will be OK.
There might be several identical order lines (order number wise) and the codes next to each order number might be the same.
If even ONE of the codes next to each order line is NOT zero - the "mark" for ALL the SAME orders will be "NOT OK".
The database is sorted by order number and then by code (in real life there are a few thousands of lines)
Any idea what will be the best approach to achieve the "mark"?
TIA
Sample database:
[TABLE="width: 208"]
<tbody>[TR]
[TD="align: left"]Order [/TD]
[TD][/TD]
[TD]Code[/TD]
[TD][/TD]
[TD="align: left"]Mark[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010012[/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010059[/TD]
[TD][/TD]
[TD]C[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010576[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010725[/TD]
[TD][/TD]
[TD]D[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]010946[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]011551[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]OK[/TD]
[/TR]
[TR]
[TD="align: left"]011567[/TD]
[TD][/TD]
[TD]0[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]A[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]B[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]X[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
[TR]
[TD="align: left"]011597[/TD]
[TD][/TD]
[TD]Z[/TD]
[TD][/TD]
[TD="align: left"]NOT OK[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 142"]
<tbody>[TR]
[TD="align: left"][/TD]
[TD][/TD]
[TD="align: left"][/TD]
[/TR]
</tbody>[/TABLE]