How to get last three items in a list variable?

Hi Forum, I need a query where i can get last three items in a list variable(list is ordered), if the count of items in list is greater than 3. if the counts are less than three, then i don’t want any change

Thanks is Advance.

Hi @_nithish

You can use the below expression to get the last three items in a list.

YourListVariable = If(YourListVariable.Count > 3, YourListVariable.GetRange(YourListVariable.Count - 3, 3).ToList(), YourListVariable)

Hope it helps!!

Hi @mkankatala ,thanks for the solution

1 Like

Happy Automation @_nithish

1 Like

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