Remove all from collection

Hello everyone,

I’m a novice coder and new to Uipath.

I’m having some issues removing all occurrences of a string in a collection. Using the “Remove from collection” activity seems to be only removing the first occurrence. I tried doing a little digging on the RemoveAll method available to Lists but I’m having a hard time understanding lambda expressions and predicates.

Basically I have an array of words that I need to remove from a list of strings. I’m looping through the array of words and removing the word from the collection.

Hi @DeAnteF,

Use invoke method to clear all the record.

Regards,
Arivu

Would you be able to give me an example? Say if I want to remove all occurrences of the string “happy” in my collection called wordList.

I don’t want to clear the entire collection.

Hi @DeAnteF

Assign ->WorldList=(from word in wordList where word<>“happy” select word).ToList()

Regards,
Arivu

1 Like

Thanks, really appreciate the quick response!