How to remove duplicates entries from Row and it should remove that entire Column

Hi Team,

I am trying to remove the duplicates from the row and want to get that entire column deleted.

eg:

image

Here I want to delete the Duplicate names and with the entire column.

Waiting for your valuable suggestion

@Rahulsinha

You want to delete entire Row or Column ?

And also on which column base you want to delete duplicate records.

@lakshman from Column ā€œNameā€ which are the duplicate values I am trying to delete that. :frowning:
image

Highlighte one I need to delete as it has duplicate names

1 Like

Iā€™m assuming you want to delete rows and not columns since that wouldnā€™t make much sense.
Mydatatable.DefaultView.ToTable(true, ā€œNameā€) by using de parameter true you will only get unique values from a column. The second parameter is the column you want to filter. This will give you unique values from column name

@Rahulsinha

Try below expression.

newDT = inputDT.Asenumerable().Gropyby(Function(a) a.Field(of string)(ā€œNameā€)).Select(Function(b) b.First()).CopyToDatatable()

Hi @Juan_Arriaga

Can you please give an example like how to proceed or it will be really helpful if you have a example XAML file

@lakshman Do you have any XAML file as example, as I am trying to understand the process from starting

Hi @Rahulsinha ,

It is from Datatable or Excel ?

If it is excel,you use the the below activity.

Remove Duplicates

Properties like this.

Regards
Balamurugan.S

2 Likes

@Rahulsinha

I donā€™t have any.

  1. First use Read Range activity to read the data from Excel file and will give you output as DataTable and say ā€˜inputDTā€™.

  2. And then use above expression to get unique records from input data based on Name Column.

  3. Finally use Write Range activity and pass that newDT to write into new excel file.

@lakshman Sorry, but where do I need to give the unique expression?

1 Like

@Rahulsinha

You have to use Assign activity to write that above expression.

Getting error :frowning:

@Rahulsinha

Are you saved your input data into inputDT variable or not. I.e. Read Range activity output

This is what I have done in Read range under Excel application scope

image

@Rahulsinha

But in the above screenshot it is showing inputDT is not declared. Once go to variables panel and change scope of the variable and then try once.

@lakshman

what will be the scope here?

@Rahulsinha

Are you writing above mentioned expression inside Excel application scope Activity or not ?

If not then change scope from do to entire workflow. If you click on that do scope field then drop down will come select last one in it.

First do a read range within an excel application scope to get your datatable.
then:
you have to use an assign like this
dtUniqueColumnNamesValues = Mydatatable.DefaultView.ToTable(true, ā€œNameā€)
where dtUniqueColumnNamesValues is a new datatable with only unique values names. The name my ā€œMydatatableā€ is the name of your table. Then it depends on what you need to do with the unique names. you can use a for each in your table to read the columns and decide what you want to do.


please have a look

@Rahulsinha

You have to create one more DataTable and named it as newDT and it should be on left hand side in Assign activity and Right hand site you have to write inputDTā€¦

But you wrote Mydatatableā€¦