Show items in a list from an index

activities
studio

#1

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


#2

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.


#3

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.


#4

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.


#5

@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!!


#6

you can remove both using this statement inside assign activity

strList.RemoveRange(0, 2)


#7

@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.


#8

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


#9

Hey @Yur

Use an invoke method activity and give the proper values!

Refer to this screenshot please


#10

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

I doubt you use very large lists


#11

@Rishabh_Lakhera

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

Very friendly :wink:


#12

Thanks for your comment!!