Get a specific amount of Row items in Excel or Data Table

Hi there,

I`m facing the problem, that I have a List of entries whose row entries should be processed until a certain row number.
For example I have a variable called “number” with value = 3
The List:
000
111
222
333
444
555
666

Now I´d like to get only the first 3 values in the List (based on the variable “number”).
How can I loop the List until 3 for example and get the values?

@oeznur.loihl
Welcome to the forum

your title is mentioning Rows from Datatable
your text is mentioning List

get answers for both

shortDT = yourDataTableVar.AsEnumerable.Take(3).CopyToDataTable
arrRows = yourDataTableVar.AsEnumerable.Take(3).ToArray

shortList = ListVar.Take(3)

For List :
Num = List.Findindex(Function(v) v.Contains(Num_Var))

List = List.Take(Num+1)

Follow Same,if Input is Datatable.

If you only want to perform actions on the first three rows, you can use the MaxIterations property.

image

Otherwise, if you’re using an older activity pack I would use assign the Index to a variable and then do an if check to break the loop.