811
Views
3
Comments
Get list elements after specific index
Question
Application Type
Reactive

Hello all,

I have a list of structure.

This list contains, for example 20 elements, but I want to filter it in order to get the last 6 elements. How can I do this?


Thank you all 😊

2022-07-22 08-49-20
Laura Fidalgo

Hey Catarina,

You could use the ListFilter from (system) and write logic using the CurrentRowNumber and the length/count of the list, i.e. you want the records where the CurrentRowNumber >= (Length - 6), or something along these lines

I hope this helps :)

2020-01-08 08-43-00
Rahul Kumar

Hi Catarina Gomes,

Create a new local variable of same type where you want to keep last 6 element. 

1st Solution-

Use ListAppendAll system action-  and append value index wise.

for example-    For last 2 element use   Employee[length-1]

                                  2nd last   Employee[lenght-2] and so on. 

In below screen shot- Last2Employee is local var (Employee List type) and I am appending last 2 element of Employee list.


It is simple and easy solution when you want to take few element of list.

2nd solution-  Use for each loop and iterate form length -6 element for last 6 element. 





Hope this help.

Thanks and regards,

Rahul kr.


2025-10-18 11-13-53
Ramesh subramanian

Hey Catarina Gomes ,

For example stutents  is list 

 for each  stutents[ stutents length-i ] and increase i=i+1 upto i<=5.


thanks,

Ramesh

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.