Exists in Collection

This activity is used to find out if an item already exists in the collection.

Technical Reference

 

 

 

 

 MISC

Collection: This indicates the name of the collection variable to which the item has been added

Display Name: Displays the name of the activity. You can also customize the activity name to help troubleshoot issues faster. This name will be used for logging purposes.

Item: This indicates the name of the variable which is already added to the collection.

Result: Declare and assign a variable to return the output. This is a Boolean value. This is not a mandatory field.

TypeArgument: This indicates the type of the argument which is going to be added. There are number of options from which we can choose.

*Mandatory fields to execute the workflow

Use Case

The following activity illustrates on how we can use the exist in activity from the
collections feature to find out if an item already exists in the collection. Here we 
are going to find if the item Name exists in the collection Name_Col.

Steps to execute the bot

We are continuing the workflow from Add to collections activity.

1.      Drag and drop the Exist in Collection activity below the Write line activity.

2.      Navigate to the properties and enter the variable name as "Name_Col" in the
collection tab.

3.      Add the variable as "Name" in the Item tab.

4.      Declare a variable to the result box. Here it is “IsExists”

5.      Choose the Type Argument as string, as the item which we need to find
if it exists or not is in string

6.      Connect a WriteLine activity below the Exist in Tab to define an expression
which gives an output for the activity.

7.      Enter the VB expression as “Item Exists:” +IsExists.ToString.

8.      Execute the workflow.

The bot executes the workflow to show that the item exists in the Collection.