Add object Version 15 (Net)
Action group: Collections
Description
The action adds the specified objects to the collection by index. By default, to the end of the list.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Collection | The collection to which the object will be added | Robin.Collection | Yes | |
Index | The ordinal number of the position where the value should be inserted. Numbering starts from 0. | Robin.Numeric | No | |
Object | The object to add to the collection. | Robin.Object | Yes |
Special conditions of use
If adding multiple objects is necessary click on the plus icon:
The action has 3 parameters by default:
- Collection
- Index, numbering starts with 0
- Object
Each new "Object" parameter is a new element of the collection, added after the previous one.
If the "Index" parameter is set, all new objects are inserted starting from this position.
Case:
There was a "Collection" with values:
- Example 1
- Example 2
- Example 3
Add action with the following input data:
Expected result: "Collection"
- Example 1
- Text 1
- Text 2
- Example 2
- Example 3
Example of use
Task
There is a "Collection" variable with values:
- Mia
- Daniel
- Daniel
Add the value "Richard" with position number "2" to the collection. Then check the added value using the "Contains object" action.
Solution
Use the "Add object" and "Contains object" actions.
Implementation
- Assemble a robot scheme with the actions.
- Create a variable "Variable" with value "Richard".
- Create a variable "Collection" with following values:
- Set the "Add object" action parameters.
- Set the "Contains object" action parameters.
- Click "Start" in the top panel to start the robot.
Result
A new entry with value "Richard" and index "2" was added.
The collection contains an entry with value "Richard".