Unable to remove item from Integer List (Collection activity ) under for each loop activity

Hi team ,

I want to add all the values present in the integer list ,
after adding each number i want to delete that number from list.
i tried remove from collection and clear collection but it is gibing this error : - “For Each: Collection was modified; enumeration operation may not execute.”

attaching the xaml file as well.

the goal is to remove the item or clear list after adding data into a integer variable
CollectionIssue.xaml (6.9 KB)

@Abhinavpandey

removing an item while iterating over the list on the same time is not possible
for reseting a list you can do following:

  • new List(of Yourdatatype) within an assign
  • clear collection activity
2 Likes

issue resolved.

used clear collection activity outside the for each loop,
its working fine. the length was zero
the assign sum to zero
for next iteraction the sum is not appended

1 Like

thanks @ppr.

understood

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