Datatable order by sorting Condition question

안녕하세요

DT의 조건 정렬을 하려고합니다.

image

I want to sort the condition by the STRING value of the PART column.

(From x In DT_1.AsEnumerable() Order By convert.Tostring(x(“Date”)), convert.ToString(x(“Part”)) Select x).CopyToDataTable

Processed as above, but detailed conditions for the PART column are required.

order by 1.FFFF 2.AAAA 3.TTTTT

Please help.

Hi @yundw :wave:

Did you try the Sort Data Table activity? It’s much simpler to use.

In the activity
Is it possible to sort by string for PART column?
The sort order should be like this.

1.FFFF 2.AAAA 3.TTTTT

Try this xaml: Sort_DT.xaml (7.1 KB)

Thank you but
What I want is condition 1, the date is correct
I want to manually specify the sorting of the PART column in condition 2

Please check the photo in the question again

@yundw If you want to manually specify the sorting order of alphabets, do you have like a list or any other collection for that?

@yundw Can you share your sample Excel file? Is it like you only want to sort this DT with 5 rows? I cannot give you a dynamic solution for this, kindly elaborate.

If you are interested in creating custom sort function, you can also try this:

http://csharp.academy/custom-method-of-sorting-strings/

You may or may not refer to the collection.

It is not just a sort of [descending], [Ascending] for a specific column value of order by

I would like to specify the sort value of the column of PART.

Hey, @yundw,

In order to do this, I’d suggest to use a separate array that specifies the order you require.

Give a try to the following workflow:
CustomOrderArray.xaml (5.6 KB)

Happy automating!

1 Like

I think I can solve it thanks to you :grinning:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.