Hi all
I am showing a table in Apps, which is filtered. I also need to sort the table in descending order, but I simply cannot figure out, how I can aplly both Filter and Sort functions on the same table.
Anyone succeeded with this?
Hi all
I am showing a table in Apps, which is filtered. I also need to sort the table in descending order, but I simply cannot figure out, how I can aplly both Filter and Sort functions on the same table.
Anyone succeeded with this?
Hello @Bjarne_Orvad_Dreier
’ Assuming you have a DataTable named “dt” that you want to filter and sort
Dim dt As DataTable = New DataTable()
’ Apply filtering
Dim filteredRows As DataRow() = dt.Select(“Column1 = ‘FilterValue’”)
’ Apply sorting to the filtered rows
Dim sortedFilteredRows As DataRow() = filteredRows.OrderBy(Function(row) row(“SortColumn”)).ToArray()
’ Create a new DataTable to store the sorted and filtered rows
Dim resultDt As DataTable = dt.Clone() ’ Cloning the structure of the original DataTable
’ Add sorted and filtered rows to the result DataTable
For Each row In sortedFilteredRows
resultDt.ImportRow(row)
Next
’ Now, “resultDt” contains the sorted and filtered data
Thanks & Cheers!!!
Use the Sort Data Table and Filter Data Table activities on the datatable.
Sorry guys, I was not being precise.
The table I am showing in my App, is coming from and entity directly, and is not running a background process.
So I am left with this; https://docs.uipath.com/apps/automation-cloud/latest/user-guide/function-sort and this; https://docs.uipath.com/apps/automation-cloud/latest/user-guide/function-filter but not sure how I can combine those.