"Clear Collection" activity

Created by akaBot Support, Modified on Fri, 27 Dec, 2024 at 4:18 PM by akaBot Support

Here’s an introduction to the "Clear Collection" activity.


TABLE OF CONTENTS

  1. Activity program name
  2. Description
  3. Properties
  4. Usage


1. Activity program name

System.Activities.Statements.ClearCollection

2. Description

  • For Studio Version 2.0.2.0 and earlier
    Quick Access: Toolbox > Collection > Clear Collection

  • From Studio Version 2.0.3.0 onward
    Quick Access: Toolbox > System > Collection > Clear Collection

This activity clears all data from the specified collection.

Notes:

  • Verified on Studio Version: 2.2.0.5
  • Terminology and features may vary slightly depending on the version.


3. Properties


Property itemProperty nameInput fieldsDescription
MiscTypeArgumentDropdown selection

Allows you to select any data type.

Collection

Enter Value (Collection<TypeArgument> Type)

Set the collection to be cleared.

PublicCheck boxVariables and arguments within the activity are written to the log file and pushed to the Center. (For details, refer to "About the 'Public' Property.")
Display nameAnyString

Reflected as the activity name in the Designer Panel.


4. Usage


Here’s an example of using the "Clear Collection" activity to empty data stored in a newly created List type.


First, drag and drop "Assign" from System > Custom into the workflow.



In the Properties panel, under Misc> To, enter a variable of type List<String> (in this example, "sample"). Then, in the Value field, input the value as well. (In this example, enter new List(Of String) From {"A", "B", "C"}).

For information on creating variables, refer to "How to create variables".



Next, drag and drop "Clear Collection" from System > Collection into the workflow.


In the Properties panel, click on Misc > TypeArgument and select String.



Next, in the Properties panel, under Misc > Collection, enter the List<String>variable (in this example, "sample").



To verify the number of values stored in the List<String>, add "Write Line" from System > Primitives to the workflow and configure the necessary variables.

In this example, enter: "Data count: " + sample.Count.ToString.



To retrieve the values stored in the List<String>, drag and drop "For Each (Collection)" from System > Control Flow, followed by another "Write Line", and place them in the workflow.

Note: Configure the properties for "For Each (Collection)" and "Write Line" in the same way as described in "Add to Collection".


Click "Home > Run" or press the F5 key to execute the workflow and open the Output panel.

Verify that the data count is 0 and no data content is displayed, as the collection elements have been cleared.



[Reference] Execute the workflow by commenting out the "Clear Collection" activity and then clicking "Home > Run" or pressing the F5 key.

Verify that the data count and the content of the data (A, B, C) are displayed.



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