Add pair Version 11 (Net)

Action group: Collections Subgroup: Dictionaries


Description

The action adds the key-value pair defined by the "Key" and "Value" parameters to the dictionary.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
DictionaryThe dictionary to which the object will be addedRobin.Dictionary
Yes
KeyThe key of the added objectRobin.String
Yes
ValueThe object to be added to the dictionary as a valuesRobin.Object
Yes

Special conditions of use

If nothing is specified in the Value parameter, a pair will be created with an empty value for the specified key.

Example of use

Task

There is a variable "Dictionary" with two keys. With values 1 - Moscow, 2 - Tokyo. It is necessary to add key 3 with the value Madrid to this dictionary, output the added value in the dialog box. 

Solution

Use the "Add pair" action , "Get values", "Get value by index", "Show message".  

The scheme looks as follows: 

Implementation

  1. Move the "Add pair" action to the workspace and customize its parameters. Beforehand, it is necessary to create a variable "Dictionary" with the data type "Dictionary".
  2. Move the "Get values" action to the workspace and set its parameters. Beforehand it is necessary to create a variable "Collection" (type - collection). 
  3. Move the "Get value by index" action to the workspace and set its parameters. Beforehand it is necessary to create a variable "object" to record the result of the action. 
  4. Move the "Show message" action to the workspace and set its parameters.
  5. Launch the robot using the "Start" button in the top panel. 

Result

Key 3 with the value Madrid is added to the dictionary. The added value is displayed in the dialog box. 

  • Нет меток