How to Sort DataTable Columns?

datatable
excel
activities

#1

I have this kind of columns, is there any way to sort the columns, and make the rows following too (not sorting the rows by its columns)?

Current Data:
result

Expected Result:
result

Thank you in advance!


#2

ColumnSort.xaml (10.2 KB)


#3

I was looking at this at same time as @vvaidya, cause this got me interested.

Here is my solution. It’s basically the same, just slightly different logic.
SortColumns.xaml (11.9 KB)

I wonder if this is possible without a ForEach though like through vb.net only. Probably not since it changes the datatable.


#4

Hey @whyyouandi

please find the attached sample workflow: Sort_DataTable Columns.zip (8.1 KB)

This one is without set-ordinal and loop :slight_smile:

REgards…!!
AKsh


#5

Thank you @vvaidya, @ClaytonM and @aksh1yadav for the fast5 reply and kindly making the sample too.

Decided the Solution based on personal preference (I don’t understand VB so a slightly difficult but not having many activities saved me a lot when remembering), but tried all of them and all working nice as a solution for the question. Again thank you!