# Datatable sort

**URL:** <https://forum.uipath.com/t/datatable-sort/454244>\
**Category:** Studio\
**Created:** [July 6, 2022, 9:34am UTC](https://forum.uipath.com/t/datatable-sort/454244 "2022-07-06T09:34:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kumar802](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kumar802/32/267681_2.png) [@Kumar802](https://forum.uipath.com/u/Kumar802)\
**Post date:** [July 6, 2022, 9:34am UTC](https://forum.uipath.com/t/datatable-sort/454244/1 "2022-07-06T09:34:53Z")

</div>

hello,

I would need to sort a datatable for a specific column: “Column1”

The rules I should follow are as follows:

- First only the numericals, in ascending order
- Then the alphanumerics, in ascending order (ex. 100a - 100b - 101a)
- Then those containing only letters, in ascending order

Is it possible to handle this casuistry via a linq? In what way?

Thank you

---

<div class="post-metadata">

**Author:** ![Andile\_Wayne\_Lukhele](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/andile_wayne_lukhele/32/290231_2.png) [@Andile\_Wayne\_Lukhele](https://forum.uipath.com/u/Andile_Wayne_Lukhele)\
**Post date:** [July 6, 2022, 9:48am UTC](https://forum.uipath.com/t/datatable-sort/454244/2 "2022-07-06T09:48:58Z")

</div>

[BlankProcess22.zip](https://forum.uipath.com/uploads/short-url/lfIA3zBDvFJIvos87GRVZOLf1lb.zip) (13.8 KB)  
Please download and run hopefully it is what you want

---

<div class="post-metadata">

**Author:** ![Kumar802](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kumar802/32/267681_2.png) [@Kumar802](https://forum.uipath.com/u/Kumar802)\
**Post date:** [July 6, 2022, 10:13am UTC](https://forum.uipath.com/t/datatable-sort/454244/3 "2022-07-06T10:13:58Z")

</div>

Thanks for the help, but…

this is the expected result

![image](https://global.discourse-cdn.com/uipath/original/4X/7/6/c/76ccc8b87493e0319601399940a9eb386e353f1a.png)

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [July 6, 2022, 10:17am UTC](https://forum.uipath.com/t/datatable-sort/454244/4 "2022-07-06T10:17:27Z")

</div>

Hi,

How about the following?

 ![image](https://global.discourse-cdn.com/uipath/original/4X/2/a/1/2a14d744608b4f9eab822876bb7e831212f7d6ee.png)

```
dt = dt.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r(0).ToString,"^\d+$")).OrderBy(Function(r) Double.Parse(r(0).ToString)).Concat(dt.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r(0).ToString,"[A-Za-z]") AndAlso System.Text.RegularExpressions.Regex.IsMatch(r(0).ToString,"\d") AndAlso System.Text.RegularExpressions.Regex.IsMatch(r(0).ToString,"^[0-9A-Za-z]+$")).OrderBy(Function(r) r(0).ToString)).Concat(dt.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r(0).ToString,"^[A-Za-z]+$")).OrderBy(Function(r) r(0).ToString)).CopyToDataTable

```

[Sample20220706-2.zip](https://forum.uipath.com/uploads/short-url/l01cqLipCgsVe9JTJysy4KrbgsO.zip) (2.8 KB)

Regards,

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [July 9, 2022, 10:17am UTC](https://forum.uipath.com/t/datatable-sort/454244/5 "2022-07-09T10:17:47Z")

</div>

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