11-01-24 01:59 AM
Hi,
I have not found a correct answer to this question can you please help 🙂
I want to delete duplicate rows across all columns in the table. My table has some blanks rows
I have seen the removes duplicates function; I have tried but it doesn't work. I delete everything except the headers and the 1st row....
And, this is the code stage in the object. I don't know about coding so I do not prefer changing any code.
Try
Dim wb, ws As Object
Dim excel, sheet, range As Object
wb = GetWorkbook(handle, workbookname)
ws = GetWorksheet(handle, workbookname, worksheetname)
wb.Activate()
ws.Activate()
excel = ws.Application
sheet = excel.ActiveSheet
range = sheet.Range(Input_Range)
range.Select()
ws.Range(Input_Range).RemoveDuplicates (Columns:=New Object() {columnindexes}, Header:= 1)
result = True
Catch ex As Exception
result = False
message = ex.Message
End Try
------------------------------------------------------------------------------
I have an example. The result is not the same as what Excel provide and I don't know why......
Pers.No. | Personnel Name | Item Type |
80000 | Joe | |
80004 | Fred | Supervisor ID and Name |
80004 | Fred | |
80004 | Fred | Manager ID and Name |
80006 | Sarah | Supervisor ID and Name |
80006 | Sarah | |
80004 | Fred | Manager ID and Name |
80006 | Sarah | Manager ID and Name |
80007 | Emily | Supervisor ID and Name |
80007 | Emily | |
80006 | Sarah | Supervisor ID and Name |
80007 | Emily | Manager ID and Name |
80008 | Cameron | Supervisor ID and Name |
80008 | Cameron | |
80008 | Cameron | Manager ID and Name |
------------------------------
Mia Mikela
------------------------------
11-01-24 03:37 AM
Hello @Mia Mikela,
Try this asset in DX
https://digitalexchange.blueprism.com/dx/entry/127021/solution/generic-data-table-filter-utility
Hope this asset helps you
11-01-24 07:43 AM
Hi Mitsuko, thanks for recommending but it's not working for my case.
15-01-24 10:05 AM
Hello @Mia Mikela,
So you want to delete "rows in a table where all the entries are exact matches"?
In other words, am I correct in understanding that the example you provided, rows 9 and 13 are correct to be deleted?
I propose to create an action like this:
The code stage 'Remove Duplicate' contains only one line as follows:
outCollection=inCollection.DefaultView.ToTable(true)
Input Argument is 'inCollection'
Output Argument is 'outCollection'
This is a simple code stage, so even if you are not familiar with coding, it will be easy to create.
15-01-24 01:16 PM
We don't use that VBO so I have never tried out that action but I do know that Excel's array indexing is 1-based. You are using 0-based indexing for the columns. You could give 1-based indexing a try and see how that works for the action.