DataTable

datatable
excel
uiautomation
activities

#1

Hi All,

Use below code to remove empty row from the table.
DataTable name->DataTableName
Use assign activity
DataTableName=DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable()

Re-usable Component pass Parameter as datatable you will get the answer.

RemoveEmptyRows.xaml (8.5 KB)

Remove rows based on particular column is empty.
DataTableName.Select("Convert(column3, System.String)< >''").CopyToDataTable()
or
DataTableName.Select("column3< >''").CopyToDataTable()

Distinct Based on the specific column name from the data table and need to return the hole data.
Remove Duplicate record from the Data Table based on Column Name
dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)("ColumnName")).Select(Function(g) g.First).CopyToDataTable()
Or
((From LineNo In dt.DefaultView.ToTable(True,"Product").Select().ToList() Select (From row In dt.Select Where row("Product").ToString=LineNo("Product").ToString Select row).ToList(0)).ToList()).CopyToDatatable()

Distinct Based on the specific column name from the data table.

DataView view = new DataView(table)
DataTable distinctValues = view.ToTable(true, "Column1", "Column2" ...)
or
DataTable =DataTable.DefaultView.ToTable(true)

Sorting the data table based on particular column name
dt = dt.Select("",[ColumnName] asc").CopyToDataTable()

Duplicate records from the same data table
(From p in dt.Select() where( From q in dt.Select() where string.Join(",",q.ItemArray).Equals(string.Join(",",p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

Duplicate records from the same data table and
If you want specific Column alone mention the column name

(From p in dt.Select() where( From q in dt.Select() where q("ColumnName").Equals(p("ColumnName")) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

Get Max value from the data table column value
int MaxValue=Convert.ToInt32(dt.AsEnumerable().Max(Function(row) row("Column2")))

Join Two Data table
JoinTables.xaml (10.6 KB)

Regards,
Arivu


Deleteing the whole row if ( condition)
Search for column value and merge data cells
Duplicate rows in data table
How to check if there are duplicates in the rows of Data Table
Compare rows from one excel to other excel
How to create a re-usable component in uipath?
How to group repeated email ids present in one column of datatable
Update datatable
Deleting rows from a sheet after filtering
Sort elements in a excel document and save it in a new sheet
Merge two datatables with common column
Remove Empty Rows From DataTable
No Sort/Filter Data Table in UIPath
Delete empty row from Datatable
Get distinct value in column excel
Remove data row activity is not working in for each loop
Linq in Data Tables
How to get duplicate rows for specific column in a datatable
Excel Automation process
How can I find all the values in the duplicate column and merge the duplicate rows?
Filter Table not executing
How to Remove Duplicate Columns in Excel and have the distinct values in the other sheet
How to Remove Duplicate Columns in Excel and have the distinct values in the other sheet
Remove duplicates before inserting into database
How to find blank rows
Remove duplicate database error
Filter Datatable - Not like filter
How to remove blank row from dataTable
Group by - Data table
Datatable return a row item value if column equals something
How to remove empty cells from datatable?
How to delete the duplicates