How to use custom sort in Data Table

Hello,

I have a column on a Excel file, which contains different values. I need to sort that column by value. For example :

Capture
Untitled

Thanks :slight_smile:

Hello @ppr

Can you please, explain how can I use this ? Thanks

Currently the requested sort type is is lexically (A,B,C) or Numerical. May we ask you to give us more details on your requirements for the custom sort.

Default sorting we can do with

  • Sort DataTable activity
  • LINQ
1 Like

@ppr

No it’s not lexically nor numerical. Something like this :

0df1bf4b0bc23d7298bd82558fb5c18cc508506d

@ppr

is it clear for you now ?

Currently Dallas > Fort Worth > Plano - lexically D>F>P

If custom sort is needed then create the dictionary as described in the linked post and use it for the sorting. In case of many values are to store within the dictionary we can quickly create a dictionary from an excel by using a few lines of LINQ

1 Like

@ppr

Hello, It’s exactly what I need, I have custom values. Can you please share an example with the dictionary ? I tried to use filters and merge, but seems not the right way.

Thank you in advance !

Similar to the linked post from above

Variables:

Setting up a datatable with the Sort Order Config (can also be externalized to an excel file)
grafik

Creating the dictionarly from Config Table:
grafik

Doing the sorting:
grafik

Sample Data:
grafik

Find starter Help here:
DT_CustomSort_DictApproach.xaml (9.8 KB)

2 Likes

@ppr

Alright, I will follow your tutorial and get back to you. Thank you :smiley:

@ppr

Hello, I’m grateful for your help, it’s exactly what I was looking for. Thank you :slight_smile:

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