Collection Operations
Use this action to perform collection operations such as Concat, Difference, Flatten, Intersection, Union, Unique, Order, Filter, and Date Filter on the given array.
Using Collection Operations Action
To use this action in your workflow, connect it to ThingWorx Flow. To connect to the flow, do the following:
1. Click and drag the Collection Operations action under the Operations utility to the canvas, place the pointer on the action, and then click or double-click the action. The Collection Operations action window opens.
2. Edit the label name, if needed. By default, the label name is same as the action name.
3. To add an operation, select a collection operation:
Concat—Concatenate two or more collections into a single collection.
Difference—Difference between two collections
Flatten—Recursively flattens the collection
Intersection—Creates a collection of common values present in the input collections.
Union—Creates a collection of unique values present in the input collections.
Unique—Creates a duplicate free collection of values present in the input collections.
Order—Creates a sorted version of collection as per the specified key.
Filter—Define filters to retrieve only specific objects from the given collection.
Date Filter—Define date filters to retrieve only specific objects from the given collection.
4. Specify the input collection and enter values in the other fields as per the selected operation.
5. Click Done.
Using the Concat Operation
To use the Concat Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Concat operation.
2. In the Specify Another Collection field, enter another collection of arrays to perform the Concat operation.
3. Click Done.
Using the Difference Operation
To use the Difference Operation, enter the following details:
1. In the Specify Collection field, specify a collection of arrays to perform the Difference operation.
2. Specify Another Collection field, specify another collection of arrays to perform the Difference operation.
3. Click Done.
Using the Flatten Operation
To use the Flatten Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Flatten operation.
2. Click Done.
Using the Intersection Operation
To use the Intersection Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Intersection operation.
2. In the Specify Another Collection field, enter another collection of arrays to perform the Intersection operation.
3. Click Done.
Using the Union Operation
To use the Union Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Union operation.
2. In the Specify Another Collection field, enter another collection of arrays to perform the Union operation.
3. Click Done.
Using the Unique Operation
To use the Unique Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Unique operation.
2. Click Done.
Using the Order Operation
To use the Order Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Order operation.
2. Click + to view the additional fields, and then enter the details that follow:
Select Order By—The order to sort the output.
Specify Keys to Order—The keys to sort the output.
3. Click Done.
Using the Filter Operation
To use the Filter Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Filter operation.
2. In the Select Filter Operation field, select a filter operation to perform on a key of the selected collection.
Value to match—Specify an expected value for the key. This field appears when we select the following options from the Select Filter Operation list—Is Equal, Is Not Equal, Greater Than, and Less Than.
3. In the Specify Key to Filter field, select a key on which you want to perform the filter operation.
4. Click Done.
Using the Date Filter Operation
To use the Date Filter Operation, enter the following details:
1. In the Specify Collection field, enter a collection of arrays to perform the Date Filter operation.
2. In the Select Date Key field, select a date type key on which you want to apply this filter.
3. In the Date Format Type field, select a date format type.
4. In the Specify Number of Days field, enter the number of preceding days to fetch the results.
5. Click Done.
Output Schema
The Collection Operations action returns an output schema as shown in the figure that follows:
Was this helpful?