Remove multiple items from list per index

Hi, I need to Remove multiple items from a List Variable per index.
List is:
List ArrList
0,
1,
2,
3,
4,
5,
6,
7

How do i remove index 4,5,6 and 7?

@rohangroombridge,

You can use RemoveAt to remove item from a list using its Index

yourList.RemoveAt(1)

if you need to remove with item value then

yourList.Remove("yourItemValue")

Hi, Do i use that in an assign activity and assign it back to the list variable? if so i am getting an error of “Expression doesnt produce a value”

Use this option and try.

Here I have converted my list (List(Of String) into an array just to pass it in the Remove from Collection Activity.

Hi @rohangroombridge,

You can use Remove From List activity to remove your desire item from list.

I am attaching the workflow for your reference. RemoveList.xaml (6.9 KB)

@rohangroombridge
In Case of you have the values that are to removed from the Origin list available in a list or Array, then removal can also be realized in one Go with an except Statement.
IT would Go in this direction:

Using an assign Activity
Filteredlist = origlist.except(listofvaluestonremove).tolist

2 Likes