Tasks
Set List
Sets a list of values to a stub data key
You can set, add or remove items to/from an array data key in stub data.
Items need to be with a JSON array or a string with delimited strings. A delimiter parameter is required if you wish you use a delimited string.
You can also add items using data substitution.
Uses
- Keeping track of a list of events
- Aggregating specific file objects for later use
Basic usage
Parameters
fieldname required string
This is the fieldname to which the list will be written to in stub.data
set_items optional array
Use this param as an array to set the contents of the list [fieldname]. Anything that was in the list will be replaced.
add_items optional array
Use this param as an array of items to be added to the contents of the list [fieldname]
remove_items optional array
Use this param as an array of items to have removed from the contents of the list [fieldname]
At least on of the following is required:
- set_items
- add_items
- remove_items
delimiter optional string
Required if your set_items, add_items, remove_items parameter is a string of items that are delimited by specific character.
Specify the delimiter character in this parameter.
Result
Properties
payload.fieldname
The data key to which the list was written to in stub.data
payload.items
The data that is was stored into the [fieldname] data key
Examples
These are some more complex examples
Add items to a list
Existing Data
Task
Result
Remove Item from list
write something about this example here
Existing Data
Task
Result
Setting the Contents of the list from a Delimited String
Result
Using Substituted data in lists
You can add, remove or set list data using substituted data.
The data key used in add_items, remove_items & set_items should reference a JSON array.