# Get Range from Datatable Set to Array

**URL:** <https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415>\
**Category:** Reboot Your Skills 2021\
**Tags:** week-4\
**Created:** [June 30, 2021, 1:33pm UTC](https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415 "2021-06-30T13:33:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarioHerrmann](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/marioherrmann/32/504765_2.png) [@MarioHerrmann](https://forum.uipath.com/u/MarioHerrmann)\
**Post date:** [June 30, 2021, 1:33pm UTC](https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415/1 "2021-06-30T13:33:37Z")

</div>

Hi I have a datatable that is structured like this.

![image](https://global.discourse-cdn.com/uipath/original/3X/3/f/3f277b29cbd515df4141436c6e9a27812b194cf8.png)

Now I would like to put the rows from F-row to before F-row into an array without iterating over each row and putting the result at the end of the string.

It should look like this

Array[{F-row, G-row, K-row, K-row, G-row, K-row}, {F-row, …}] (hope the bracket syntax is correct but you know what I mean 😉 )  
(Important is that the number of rows between F and F can be different)

I don’t really care about the data type of the array element but DT would be nice.

Unfortunately I didn’t find out with the select function how this can be done (if this is possible).

---

<div class="post-metadata">

**Author:** ![kumar.varun2](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kumar.varun2/32/215924_2.png) [@kumar.varun2](https://forum.uipath.com/u/kumar.varun2)\
**Post date:** [June 30, 2021, 1:56pm UTC](https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415/2 "2021-06-30T13:56:52Z")

</div>

Hi @MarioHerrmann

Can you provide the sample output and input?

It can be achieved like this-

 ![image](https://global.discourse-cdn.com/uipath/original/3X/2/d/2d485991d9b17b3dc8376d411f2016da9662029d.png)

Code -

```auto
System.Text.RegularExpressions.Regex.Split(String.Join(",", inputDT.AsEnumerable.Select(Function (r) String.Join(",",r.ItemArray)).ToArray).Replace("F,", "~F,"), "~").skip(1).ToArray

```

output -

```auto
string[4] { "F,0,126,G,0,8125,K,0,0,K,0,0,G,0,8624,K,0,0,", "F,0,126,G,0,8125,K,0,0,K,0,0,G,0,8624,K,0,0,", "F,0,126,G,0,8125,K,0,0,G,0,8624,K,0,0,", "F,0,126,G,0,8125,K,0,0,G,0,8624,K,0,0" }

```

---

<div class="post-metadata">

**Author:** ![MarioHerrmann](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/marioherrmann/32/504765_2.png) [@MarioHerrmann](https://forum.uipath.com/u/MarioHerrmann)\
**Post date:** [July 1, 2021, 8:51am UTC](https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415/3 "2021-07-01T08:51:33Z")

</div>

Thanks for the perfect solution to my question!  
Unfortunately, I have only now seen thanks to your answer that there is another column in which an F stands.  
Thus, regex unfortunately does not work. because I still need the later columns.

Here again the extended content of the table

 ![image](https://global.discourse-cdn.com/uipath/original/3X/2/b/2b8279672d63149669b240342c87087331c75b7f.png)

Can not also refer only to the 1st column?  
and can I not declare the datatype of the array as DT.  
And where can I read this 🙂

---

<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 4, 2021, 8:52am UTC](https://forum.uipath.com/t/get-range-from-datatable-set-to-array/326415/4 "2021-07-04T08:52:05Z")

</div>

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