I need help in sorting data tables:
for example column A contains the values of apple, banana, pears
and I want to sort this column first by the value banana - the order afterward its not important to me
thanks in advanced
I need help in sorting data tables:
for example column A contains the values of apple, banana, pears
and I want to sort this column first by the value banana - the order afterward its not important to me
thanks in advanced
give a try on following
(From d in dtData.AsEnumerable
let so = IF( d(“ColAName”).toString.trim.toUpper.Equals(“BANANA”), 0,1)
Order by so
Select d).CopyToDataTable
sure, lets assume following sample data:
ColumnA |
---|
apple |
orange |
banana |
As far we did understand you would like to get sorted banana first
ColumnA |
---|
banana |
apple |
orange |
Use an assign activity
left side: dtSorted | DataType: DataTable
Right side:
(From d in dtData.AsEnumerable
let so = IF( d(“ColAName”).toString.trim.toUpper.Equals(“BANANA”), 0,1)
Order by so
Select d).CopyToDataTable
dtData - rename it to your variable representing the datatable which is to process
ColAName - rename it to your column name
Kindly note: if your datatable has additional Datacolumns the statement would be the same one
ok, now i will tackle you
i want to sort my DataTable variable by this condition and also by another column (lets say unit price)
should not be a problem.
Share the sample data of your case representing all scenario and the expected output along with additional description if it can help for further understanding. Thanks
can you explain a bit more? where should i insert the addition column?
can i use sort activity and not assign?