Create List

Estimated reading: 4 minutes 84 views

The Create List activity is used to initialize a list variable of a specific type (e.g., Integer, String, Object). By default, the created list is empty until you assign or add values.

Properties

MISC

Display Name: Displays the name of the activity. The activity name can be customized, which aids in troubleshooting.

SkipOnError: Specify the “Boolean” value as “True” or “False.”

True: Continue executing the workflow regardless of any errors thrown.
False: Halt the workflow if it encounters any errors.
None: If the option is left blank, the activity will, by default, behave as if “False” were chosen.

Type Argument: Select the type of variable to be created from the drop-down.
For example, if it is a list of strings, choose “String” as the argument type.

By default, the argument type should be as “String”.

Version: It indicates the version of the feature being used.

OUTPUT

NewList: *Returns a new list based on the selected variable type as the output.

Result: This parameter allows you to view the execution status of the activity and returns a value in “Boolean.”

True: Indicates that the activity has been executed successfully without any errors.
False: Indicates that the activity has been unsuccessful due to an unexpected error being thrown.

* Represents mandatory fields to execute the workflow.

How to Use the Create List Activity?

The Create List activity generates an empty list variable with null values. To add values, you need to assign values to the list. Below are the three ways you can do this:

1. Add to Collection activity
2. Assign activity
3. Update / Append List activity

Step 1: Create the List

1. Drag and drop the Create List activity into your workflow.
2. Set the Type Argument (e.g., Integer).
3. Declare the variable in the NewList parameter.

At this point, a list of the selected types (for example, integers) has been created, but it’s still empty. Next, let’s assign values.

Step 2: Assigning Values Using the Assign Activity

You can populate the list with values using either the Assign activity or the Update List activity.

To use the Assign activity:

4. Drag and drop an Assign activity after the Create List activity.
5. In the To field, enter the variable name created in the Create List activity.
6. In the Value field, use this syntax:

New List(Of Int32) From {32, 16, 24, 12}

Example:
For a list of strings, the Assign activity should look like this:

STRLIST = New List(Of String) From {“Apple”, “Banana”, “Cherry”}

Click here to learn how to assign values using the Update List or Append List activities.

Step 3: Reading List Values

To read or print the values from the list, use the Read List activity. This will allow you to retrieve the stored items and print them in your workflow using Write log activity.

When to Use For Each?

Yes, you need to use For Each if you want to iterate through all items in the list and perform an action on each one.

a. Use Read List when you want to fetch the entire list as an output.
b. Use For Each when you want to process each value individually.

Iterating Through a List

To process or read items inside a list, use the For Each activity.

Steps:

1. Drag and drop a For Each activity.
2. In the Values field, provide the list variable (e.g., NumList).
3. Set the Type Argument (e.g., Int32 if the list is integers).
4. Inside the loop, use activities like Write Log to print the output.
5. In the Writelog activity, enter the input string as “item.Tostring”.

So, the Create List activity itself only initializes the list. To use the list effectively, you combine it with Assign / append / Update list (to add values to it) and Read list / For Each (to iterate through it).

Share this Doc

Create List

Or copy link

CONTENTS