Comparing 2 columns in same Datatable

I want to retrieve the first sales order number, from the 2 sales orders number having same PO number… if anybody can help?
image

Well, if the value on the order number is gonna be the same and you want to get always the first row after every duplicate of it… This will work, Copy the excel sheet in to a DT have a counter value after each row iteration. For each counter+1 iteration (like 1,3, 5) check if it equals the value row(“Sales Order Number”).ToString.equals “counter +1”. if yes, there you go… and retrieve the row(“PO number”).ToString for that counter value. Hope this helps. Cheers.

@anjasing,

Can you please follow screenshot below?

image

Hi,

Can you try the following expression?

dt = dt.AsEnumerable.Where(Function(r) r("Sales Order Number").ToString=dt.AsEnumerable.Where(Function(r2) r2("PO Number").ToString=r("PO Number").ToString).First().Item("Sales Order Number").ToString).CopyToDataTable

Regards,

It’s not giving expected solution

Hi,

We can easily get them from datatable as the following.

Or can you show us which variable type you want to get as result?

Regards,

Can you show the output here or share the sequence, and please read the Question again …I made a change

Hi,

Output is 1 and 3, isn’t it?

Main.xaml (9.4 KB)

Thank you so much. It is working. :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.