How to get Bottom N rows from DataTable in UiPath

Using DataTable is a major part of any automation process.

How does this help in real-time scenarios?

When you stored all the required data in a DataTable from csv/xlsx.

At a certain point in time, you require to process top N rows from the whole DataTable.

Let’s assume a scenario where you have to pick values from DataTable and search in Google and write it back to excel.

But there is huge data so you need to process them by taking Bottom N rows. There might be several reasons why you have to do this.

One among them is when you are automating continuously the responsiveness of that application (here it is Google).

Now let’s see how we can achieve this:

First let us build a DataTable by using Build DataTable Activity.

uipath

Here is our DataTable which consists of 3 Rows and 2 Columns.

Now I want to skip only 2 Rows from this DataTable. you can achieve that by using the below expression :

uipath

Here BottomNrecordesDT is a DataTable variable where I am storing the top n records from the current DataTable DT.

Skip(2) – it allows you to set the number of Rows that you want to Skip from DataTable.

Here it is Bottom 1 Row.

The output looks like this:

uipath

We got Bottom 1 Rows from the original DataTable which has 3 Rows.

This is how you get Bottom N rows from a DataTable in UiPath.

Happy Learning!

Like this post then let your friends know about this-:

Leave a Reply

Your email address will not be published. Required fields are marked *