When to use the Remove from the Collection activity

This activity is used to remove certain data stored from the collection.

Figure 1

Activity Name

Picture

 Remove from Collection

Technical Reference

Figure 1.1

Remove

Select the TypeArgument based on the variable declared in the AddtoCollectionRelated image

 

Scenario

In the aforementioned scenario, we stored the employee data of those who have worked for more than 10 years. Now, the requirement is to remove the employee data of candidates with less than 3 years of experience.

Illustration

Activity: To remove the daRelated imageta from the Collection, use the RemoveFromCollection activity.

 

Step 1 Drag a RemoveFromCollection activity and connect the activity to the True branch under the Experience Validation decision to remove certain data from the collection.

  • Go to the property section and fill in the details, enter the variable name as Add under Collection field which was already declared for AddToCollection process        
  • Define the syntax as add(i)in the item field. This provides the employee experience and index number i.e., the data that the robot requires to validate
  • The result field specifies if the data has been removed from the collection or not. Declare the variable type as Boolean
  • In the aforementioned scenario we selected the TypeArgument as "String". The same condition needs to be applied here to remove certain data.   

Step 2  Drag a WriteLog activity to print Next Employee message and loop the flow to Count validation decision, so that the flow executes in a loop to remove the data of employees below 3 years of experience.

Step 3 Drag an Assign Activity and connect the activity into the False branch. This counter is used to dynamically retrieve the data from collection and to validate if the number of iterations has crossed the collection count (number of rows to be processed)

  • Declare a new variable with type as "Integer" to capture the counter value under the variable section. 
  • Key in the variable name under "To" Field which was already declared for  AddtoCollection increment and update i+1 under value section to increment the value and loop the flow to Count validation decision, so that robot will validate if the number of iterations have crossed the collection count (number of rows to be processed)