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
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Dictionary | The dictionary to which the object will be added | Robin.Dictionary | Yes | |
Key | The key of the added object | Robin.String | Yes | |
Value | The object to be added to the dictionary as a values | Robin.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
- 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".
- Move the "Get values" action to the workspace and set its parameters. Beforehand it is necessary to create a variable "Collection" (type - collection).
- 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.
- Move the "Show message" action to the workspace and set its parameters.
- 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.
Обзор
Инструменты контента