История страницы
...
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
Особые условия использования
Если в параметре "Значение" ничего не будет указано, то будет создана пара с пустым значением для указанного ключа.
Пример использования
Задача
Имеется переменная "Словарь" с двумя ключами. С. значениями 1 - Москва, 2 - Токио. Необходимо добавить ключ 3 с значением Мадрид в данный словарь, вывести добавленное значение в диалоговое окно.
Решение
...
Схема выглядит следующим образом:
Реализация
...
.