I want tot sort date (old to new) column Planned Start in datatable dt_result but error as below.
Please guide me for solve it,
Thank you.
I want tot sort date (old to new) column Planned Start in datatable dt_result but error as below.
Please guide me for solve it,
Thank you.
Hi @Stef_99
Try this:
dt_Result.AsEnumerable().OrderBy(Function(row) row.Field(Of DateTime)("Planned Start")).CopyToDataTable()
Regards
Hi @Stef_99 ,
Sorting the data table based on particular column name
dt = dt.Select("",[ColumnName] asc").CopyToDataTable()
Regards,
Arivu
we would recommend to go through the statement and understanding what was intended, but what was coded
For LINQ in General:
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum
OrderBy Operator:
When using defaultView.ToTable method, the second method parameter is a string array with the column names
dt_Result.Columns.Cast(Of DataColumn)…wil return a collection of DataColumns
.AsEnumerable - obsolete, as Cast was used
.OrderBy -
Also with the intention of selecting a particular column value with DatarowVar(ColNameOrIndex) we will get returned value of DataType: Object. But in the majority, we are interested in an ordering which is related to the DataType (Text - lexically, Numbers - numerical, Dates - …). Therefore the Object value has correctly cast / converted / transformed into the needed datatype
For Fixings:
dtResult-DefaultView.ToTable(False, → Your String Array with ColumnNames <-)
THEN
Apply the AsEnumerable on the resulting DataTable
THEN
Order the rows (LINQ, Non-Linq)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.