Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Add pair Version 11 (Net)

Группа действий: Коллекции Подгруппа: Словари

Описание

Действие добавляет в словарь пару "ключ-значение", определяемую параметрами «Ключ» и «Значение».

Иконка действия

Image Removed

Параметры

Входные параметры

  1. Словарь - Словарь, в который будет добавлен объект;

  2. Ключ - Ключ для создаваемой пары;

  3. Значение - Значение, присваиваемое ключу;

  4. Параметры - Параметры конфигурации для распознавания текста.

Выходные параметры

Значение - выходной результат как таковой отсутствует. А результирующий словарь будет сохранен в параметре действия "Словарь".

Настройки

...

Свойство

...

Англ. наименование

...

Описание

...

Тип

...

Словарь, в который будет добавлен объект

...

Ключ для создаваемой пары.

Если ключ уже существует будет вызвана ошибка (вопрос)

...

Значение, присваиваемое ключу.

...

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

Image Added

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. 

Image Added

Solution

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

The scheme looks as follows: 

Image Added

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".
    Image Added
  2. Move the "Get values" action to the workspace and set its parameters. Beforehand it is necessary to create a variable "Collection" (type - collection). 
    Image Added
  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. 
    Image Added
  4. Move the "Show message" action to the workspace and set its parameters.
    Image Added
  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. 

Image Added

Image Added

Особые условия использования

Если в параметре "Значение" ничего не будет указано, то будет создана пара с пустым значением для указанного ключа.

Пример использования

Задача

Имеется переменная "Словарь" с двумя ключами. С. значениями 1 - Москва, 2 - Токио. Необходимо добавить ключ 3 с значением Мадрид в данный словарь, вывести добавленное значение в диалоговое окно. 

Image Removed

Решение

...

Схема выглядит следующим образом: 

Image Removed

Реализация

...

Image Removed

...