"Exist In Collection" Activity

Created by akaBot Support, Modified on Wed, 25 Dec, 2024 at 2:28 PM by akaBot Support

Table of Contents

  1. Activity Program Name

  2. Description

  3. Properties

  4. Usage


1. Activity Program Name

System.Activities.Statements.ExistsInCollection


2. Description

Up to Studio Version 2.0.2.0
Quick Access: 
Toolbox > Collections > Exists in Collection

From Studio Version 2.0.3.0
Quick Access: 
Toolbox > System > Collections > Exists in Collection

This activity checks whether the specified item exists within a collection.

  • Verified in Studio Version: 2.1.1.2

  • The wording may vary slightly depending on the version.


3. Properties


Property category

Property name

Input field

Description

Misc

TypeArgument

Dropdown

Select the desired data type.

Collection

Input field (ICollection<T>)

Specify the collection to check for the item's existence.

Public

Checkbox

Logs variables and arguments in the activity to the log file and pushes them to Center.

Result

Input field (Boolean)

Stores the result of checking whether the item exists in the collection.

Item

Input field (TypeArgument)

Specify the item to check for within the collection.

Display Name

Input field (String)

Reflected as the activity name in the designer panel.


4. Usage

The following example demonstrates checking for the existence of a specific item in a newly created List of type String.

Drag and drop the Assign activity from System > Originals to the designer panel.

In the To field under Miscellaneous properties, enter a variable of type List<String> (e.g., sample).

(Refer to the "Creating Variables" guide for details.)

In the Value field, enter: new List(Of String) From {"A", "B", "C"}

Drag and drop the Exists in Collection activity from System > Collections to the designer panel.

Click the TypeArgument property under Miscellaneous and select String.

In the Collection field, enter the List<String> variable (e.g., sample).

In the Result field, enter a variable of type Boolean (e.g., result).

In the Item field, enter a string or String type variable (e.g., "A").

To verify the execution results, drag and drop the Write Line activity from System > Originals to the designer panel and configure it with: result.ToString

Click Home > Start or press F5 to run the workflow. Open the output panel and verify the results.

  • If the item "A" exists in the collection, the output will display:
    True

         Example with "A" as the specified item:

  • If the item "D" is specified (which does not exist in the collection), the output  will display: False

Example with "D" as the specified item:





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article