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

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
CollectionThe collection to which the object will be addedRobin.Collection
Yes
IndexThe ordinal number of the position where the value should be inserted. Numbering starts from 0.Robin.Numeric
No
ObjectThe 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 

  1. Assemble a robot scheme with the actions.


  2. Create a variable "Variable" with value "Richard".


  3. Create a variable "Collection" with following values:


  4. Set the "Add object" action parameters.


  5. Set the "Contains object" action parameters.


  6. 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".

  • Нет меток