Duplicate column value

Remove the duplicates column values from a particular column and store it in a data table

Input-Dt
Column1 column2
Tin. Ting
Mag. Mang
Sec. Ting
Tuy. Mang
output-Dt
Column1 column2
Tin. Ting
Tuy. Mang
Keep first

Hi @Demo_User

You can use the remove duplicate rows activity. Which uses to delete the duplicate rows in a specific column.

Hope it helps!!

Hi @Demo_User ,

From the Output required, it seems that you have Tuy in the output where as it should have been Mag as it is the first value. Is this a Typo ?

Also, You can check the below Expression for a Starter :

OutputDT = DT.AsEnumerable.GroupBy(Function(x)x("column2").ToString).Select(Function(x)x.First).CopyToDatatable

Here, DT is the input Datatable, OutputDT is a new Datatable variable.

Let us know if the above Expression is not what was required.

Basically I want column2 value to be unique and store it to a string with semicolon seperated
O/p
String= Ting;Mang

@Demo_User ,

There is a better option for this case :

String.Join(";",DT.AsEnumerable.Select(Function(x)x("column2").ToString).Distinct.ToArray)

@Demo_User

Assign activity:
dtUnique = dtOriginal.DefaultView.ToTable(True, “ColumnName”)

The DefaultView.ToTable(True, "ColumnName") method creates a new DataTable (“dtUnique”) with distinct rows based on the specified column (“ColumnName”) from the original DataTable (“dtOriginal”). The True parameter in the ToTable method indicates that only unique rows should be included in the new DataTable.

I have list of values
If those values contains @ then will store in a list again

Please suggest me with a query

@Demo_User ,

Could you maybe provide us with a Sample data and it’s Output, so we can clear of the requirement ?

Input-lst
1233,566
Lisa@tinour
Welcome
Hung@345

Output

Lisa@tinour
Hung@345

I want the out which contains @ as a list

@Demo_User ,

Considering you already have the list now :

listVar = listVar.Where(Function(x)x.contains("@")).ToList

This should give the desired output.

It should contain @ and .com
Lis@ts.com

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