Output Data Table - Delete row if one duplicate

Hello,

I have one question - if a data table like the table below:

Cardnumber | Document number
12345 5989
12345 6050
56789 4444
56789 7777

For the further workflow I have to delete the lines with the same card number - so I should like the table below:

Cardnumber | Document number
12345 5989
56789 4444

Unfortuntaly it does not work with remove duplicates.

Any idea from your side?

Thanks in advance.

Best regards
Maurice

3 Likes

no worries
–hope we have the datatable variable ready on hand
if so
yourdatatablevariable = yourdatatablevariable.Asenumerable().Gropyby(Function(a) a.Field(of string)(“Cardnumber”)).Select(Function(b) b.First()).CopyToDatatable()

Cheers @Maurice777

2 Likes

@Maurice777

                 1) Use read range activity  and store result in **dt**
                 2) Use assign activity for query **dt** = Dt.DefaultView.Totable(True, "Cardnumber ","Document number")
                 3) **dt** will have result of

Yes, I have a Variable = listOfPostings | Type DataTable

So you mean I have to add an assign?

listOfPostings = listOfPostings.Asenumerable().Gropyby(Function(a) a.Field(Of String)(“Cardnumber”).Select(Function(b) b.First()).CopyToDatatable()

CopyToDatatable need a new data table variable?

1 Like

yah it should be like this in assign activity
listOfPostings = listOfPostings.Asenumerable().Gropyby(Function(a) a.Field(Of String)(“Cardnumber”)).Select(Function(b) b.First()).CopyToDatatable()

Cheers @Maurice777

Main.xaml (6.2 KB)

I don´t get it :confused:

1 Like

let me check once
if possible can i have the input file as well
Cheers @Maurice777

Thanks for your support. At the moment I have only this file, because I will recieve the data table from another colleague.

So my challange is at the moment to remove the rows if the card number is twice.

1 Like

@Maurice777

check & let me know this is what you required

Main.xaml (8.5 KB)

no worries
you were almost donee
i just made small changes in your workflow
its working perfectly fine
mach.zip (2.4 KB)

Cheers @Maurice777

1 Like

Perfect :)!!! Thank you very much!

1 Like

No Worries
Cheers @Maurice777

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