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 delimeted strings. A delimiter
parameter is required if you wish you use a delimeted 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
required string
fieldname This is the fieldname to which the list will be writting to in stub.data
optional array
set_items Use this param as an array to set the contents of the list [fieldname]. Anything that was in the list will be replced.
optional array
add_items Use this param as an array of items to be added to the contents of the list [fieldname]
optional array
remove_items 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
optional string
delimiter Required if your set_items, add_items, remove_items parameter is a string of items that are delimeted by specific character.
Specify the delimer 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 Delimeted 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.