Excel data has been assigned to be numeric but output excel data still appear as text (apostrophe)
please help to resolve this.
Hi @beginner_RPA,
Here you have one possible way to sort your DT:
Use an Assign activity: dt1.AsEnumerable.OrderBy(Function(r) If(IsNumeric(r(“columnname”)), CDbl(r(“columnname”)), 0) ).CopyToDatable
Cheers!
Please put the sample data of DT and also output you want it will be easy to give you solution
input data as above
Hi @beginner_RPA ,
Try as follow:
DT.AsEnumerable.OrderBy(Function(r) If(IsNumeric(r("[PO] Order Id")), CDbl(r("[PO] Order Id")), 0)).CopyToDataTable()
Cheers!
it still doesnt work
=> Read Range Workbook
Output-> dt
=> Use below syntax in Assign:
sortedDataTable = dt.AsEnumerable().OrderByDescending(Function(row) row.Field(Of String)("[PO] Order Id")).CopyToDataTable()
sortedDataTable is of DataType System.Data.DataTable
=> Write Range Workbook sortedDataTable
Regards
(From row In DT.AsEnumerable()
Order By Convert.ToDouble(row("[PO] Order Id")) Descending
Select row).CopyToDataTable()
Input:
Output:
You take a for loop to convert “[PO] Order Id” to double.Using this query there is no need for that loop so simply comment out or remove that loops
Hope it helps you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.