How to get 10 records at a time in a txt or xlsx list

How to get 10 records at a time in a txt or xlsx list

Hello, how do I get 10 records at a time from a txt list or an excel column to perform a search in a desktop software form?

The software only allows you to search 10 records at a time, I need to search to the end of this list every day.

Hi @Rodrigo_Buch,

With this assign, you can get your first 10 row of txt file.

arrFirstTenRow = Split(strText,Environment.NewLine).Take(10)

If you want to write side by side, you can use this assign after above.

String.Join(“”, arrFirstTenRow)

Regards
Ömer

1 Like

@omer.ozturk
hi What am I doing wrong?

You don’t get 10 at a time. You read the whole thing into a datatable, then manage the “10 at a time” part as you perform the steps you need to perform with the data.

@postwick
Hi
I’m trying this way but it’s still with an error there’s an example I can base myself on

I’m really not sure what you’re trying to do there.

Use Generate Datatable to turn the text into a datatable.

https://docs.uipath.com/activities/docs/generate-data-table

@postwick
what I’m trying to do is an automation that will read a txt file and select 10 lines at a time to perform a search on a system until it finishes all the lines of the file

My difficulty is to select 10 records at a time to do the search

Hi @Rodrigo_Buch ,

So, if I understand correctly, you need help building an algorithm that fits your needs.

Try this:

  • Read the text file
  • Split it into an array using String.Split you may use VbCrLf as the separator
  • Count your items
  • set an int32 variable as your index starting at 0
  • Use a while loop
    • Use another loop from index to index +9
      • Do your actions
    • Increment your index by 10, be careful not to go out of your array bounds
  • Create a counter variable
  • Do While that runs as long as the counter variable is not greater than the number of rows in the datatable
    – get the first 10 rows into a temp datatable: Top 50 Records from a DataTable - #2 by vvaidya
    – remove the first 10 rows from the original datatable
    – Use the temp datatable to do your 10 searches
    – increment counter by 10

Hi @postwick ,

Here is an activity called “Read Specific” that can read only specific line.

Regards
Balamurugan.S

1 Like

We can’t use non-UiPath packages, but yes BalaReva has a lot of useful activities.

1 Like