Add Items to Collection
Verb: addRange
Adds all items from a source collection to the end of a destination collection.
Collections are enumerated data structures that can be accessed using indexes and keys.
Syntax
addRange --source(List<Variant>) --destination(List<Variant>)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--source | Source | Required | List<Any>, Stack<Any>, Queue<Any> | Source collection of which the items are added to the end of the destination collection. |
--destination | Destination | Required | List<Any>, Stack<Any>, Queue<Any> | Destination collection that receives the items from the source collection. |
Example
Adds items from the source collection to the end of the destination collection.
defVar --name sourceCollection --type List --innertype Numeric
defVar --name destinationCollection --type List --innertype Numeric
setVar --name "${sourceCollection}" --value "[10,20,30,40,50,60,70,80,90]"
setVar --name "${destinationCollection}" --value "[5,15,25,35,45,55,65,75,85]"
addRange --source ${sourceCollection} --destination ${destinationCollection}
logMessage --message "The result after adding items from the source collection to the end of the destination collection is: ${destinationCollection}" --type "Info"
// The result after adding items from the source collection to the end of the destination collection is: 5,15,25,35,45,55,65,75,85,10,20,30,40,50,60,70,80,90]
Remarks
For correct operation of the Add Items to Collection command, the Source collection must be of the same type as the Destination collection.