Skip to content

Collection Operations

The Collection Operations node allows workflows to create, manage, and manipulate in-memory collections (such as lists of objects, strings, or numbers) dynamically during execution. It provides a simple way to initialize collections, add or remove elements, and query or serialize them for downstream tasks.


🧩 Overview

This node is designed for scenarios where you need to:

  • Accumulate results across multiple iterations.
  • Perform list-based operations (add, remove, get, join, etc.).
  • Pass structured data between workflow nodes.
  • Convert collections to and from JSON.

It supports most basic collection manipulations found in common programming environments.


🧠 Supported Operations

OperationDescription
InitializeCreates a new collection variable of a specified type (e.g., List<string>).
AddAdds a single value to an existing collection.
AddRangeAdds multiple values (from another collection or array).
RemoveRemoves a specific value from the collection (first match).
RemoveAtRemoves an item at a specific index.
ClearRemoves all elements from the collection.
CountReturns the number of items in the collection.
ContainsChecks if a given value exists in the collection.
GetReturns the item at a specified index.
GetAllReturns all elements of the collection.
JoinJoins the collection into a single string, separated by a specified delimiter.
ToJsonSerializes the collection into a JSON string.

🧾 Inputs

LabelTypeDescriptionRequiredVisible When
OperationPicklistThe operation to perform.Always visible
Collection NameTextThe variable name for the collection (used to reference it later).Always visible
Collection TypePicklistType of collection to create. Options: List<object>, List<string>, List<int>, List<double>.Initialize
ValueText / ObjectThe value to add, remove, or check for.Add, Remove, Contains
ValuesText / ArrayMultiple values to add at once (e.g., ["A","B","C"]).AddRange
IndexNumberThe index position for retrieving or removing an element.RemoveAt, Get
SeparatorTextThe character(s) used to join list elements. Default: , .Join
Output Variable NameTextOptional variable name to store the result of the operation (e.g., count, joined string, JSON, etc.).Visible for all operations

📤 Outputs

Depending on the operation:

OperationOutput TypeDescription
Initialize, Add, AddRange, Remove, RemoveAt, Clear, GetAllCollectionReturns the updated list.
CountIntegerThe total number of elements.
ContainsBooleantrue if the value exists, otherwise false.
GetObjectThe value at the specified index.
JoinStringThe concatenated string result.
ToJsonStringJSON string representation of the collection.

If Output Variable Name is provided, the result will be stored in that variable for use in subsequent nodes.


💡 Example Scenarios

Example 1: Initialize and Add Items

  1. Initialize

    • Operation: Initialize
    • Collection Name: MyList
    • Collection Type: List<string>
  2. Add

    • Operation: Add
    • Collection Name: MyList
    • Value: "First Item"
  3. AddRange

    • Operation: AddRange
    • Values: ["Second","Third","Fourth"]
  4. Count

    • Operation: Count
    • Output Variable Name: ItemCount

Result: MyList = ["First Item", "Second", "Third", "Fourth"]ItemCount = 4


Example 2: Join and Convert to JSON

  1. Join

    • Operation: Join
    • Collection Name: MyList
    • Separator: ,
    • Output Variable Name: JoinedText
  2. ToJson

    • Operation: ToJson
    • Collection Name: MyList
    • Output Variable Name: MyListJson

Result:

  • JoinedText = "First Item, Second, Third, Fourth"
  • MyListJson = ["First Item","Second","Third","Fourth"]

⚠️ Validation & Error Handling

  • Required Fields:Operation and Collection Name must be provided.
  • Type Mismatch: If an operation targets a non-list variable, execution fails with an error message.
  • Index Out of Range: When using Get or RemoveAt, the index must exist in the list.
  • Invalid Operation: Any unrecognized operation will return a failure status with message "Unsupported operation: <operation>".

🧩 Tips

  • Use Output Variable Name consistently to store intermediate results between nodes.
  • When performing numeric operations, ensure the correct collection type (List<int> or List<double>).
  • CollectionOperations is often paired with Loop, Condition, or DataOperations nodes for more complex automation logic.

🔍 Summary

FeatureDescription
PurposeManage and manipulate lists and collections dynamically during workflow execution.
Common UsesAccumulating data, filtering lists, joining strings, serializing arrays.
Key InputsOperation, Collection Name, Value/Values, Output Variable Name.
OutputsModified collections or computed results (count, boolean, string, JSON).

Example Use Case: Combine with a Loop Node to aggregate results from repeated API calls, build a list of items, and convert the list to JSON before sending to another service.

Tentech 2024