Show items in a list from an index

I need to delete the element 0 and 1 of a new List (of String) and show the rest on the screen, does anyone know how to do it?

Thank you very much

Hi @Yur

You can use Remove From Collection activity to remove specific items from your list and For Each activity to display the remaining elements in the Output pane.

Hi @Yur,

Consider that your list name as strList then you can use the follow code,

strList.RemoveAt(indexTobeRemoved)

index To be Removed - your indexes to remove one bye one, use Assign activity to remove it.

1 Like

I think this activity using Collections as base, but List of string is from System.Collections.Generic.List.
So it will not work for this List String.

@sarathi125
@loginerror

Ok I understand. But what activitie can i use to apply the removeAt function … can i remove these two elements at the same time as the List is in a For loop¿?

Thanks you very much!!

you can remove both using this statement inside assign activity

strList.RemoveRange(0, 2)

1 Like

@sarathi125

I try to do it as you say but there is no way. It does not allow me to use the assign activitie.

I attached an image in case you can help me clarify what happens.

Thanks for your contribution.

No Need to put that assign activity inside a For each loop, where you want it, there you can execute it directly.

Hey @Yur

Use an invoke method activity and give the proper values!

Refer to this screenshot please

1 Like

You can use Linq.
Something like that.
assign newList = oldList.Skip(2).ToList

I doubt you use very large lists

2 Likes

@Rishabh_Lakhera

Thank you for your comment!!
Finally I was able to get what I wanted,

Very friendly :wink:

1 Like

Thanks for your comment!!