Hello everyone, I have the following data table, as you can see in Column1 I have data 81 repeated, I must delete the first row that has the data repeated, that is, I would have to delete row 5, how can I do it?
Check this workflow
- get Clone datatable for dt_Output
- get distinct value for “Column1”
- select the CurrentRow value datatable and do Reverse the datatable then get rows 0
Input
Output
Workflow
For Each Row in Data Table
dt_Input.DefaultView.ToTable(True,"Col1")
Add Data Row
dt_Input.Select("Convert(Col1, System.String)='"+CurrentRow("Col1").ToString+"'").Reverse.CopyToDataTable.rows(0).itemarray
Xaml
Sequence.xaml (12.4 KB)
Thanks,
one more method via LinQ
Workflow
Code
(From row In dt_Input.DefaultView.ToTable(True,"Col1").AsEnumerable Let r = dt_Input.Select("Convert(Col1,System.String)='"+row("Col1").ToString+"'").Reverse.CopyToDataTable.rows(0) Select dt_Output.Rows.Add(r.itemarray)).CopyToDataTable
Thanks,
Thank you very much, both ways worked for me
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.