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

Ключ

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

...

Select Record Version 11 (Java)

Группа действий: Базы данных

Описание действия

Действие извлекает запись из указанной таблицы БД по значению ее первичного ключа. 

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

Image Removed

Параметры

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

  1. Контекст БД Контекст подключения к выбранной базе данных.

  2. Имя таблицы Имя таблицы в БД.

  3. Поля таблицы – Словарь полей, которые будут получены.

  4. Список значении полей первичного ключа – Список значении полей первичного ключа, по которым будет получена запись.

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

В результате получаем запись в виде словаря, где ключи - это указанные в запросе имена столбцов

Настройки

...

Свойство

...

Описание

...

Тип

...

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

...

Обязательность заполнения поля

...

Параметры

...

Контекст БД

...

Контекст подключения к выбранной базе данных

...

Robin.DbContext

...

Контекст баз данных

...

Да

...

Имя таблицы

...

Имя таблицы

...

Robin.String

...

Да

...

Поля таблицы

...

Поля таблицы в виде словаря, данные которых требуется получить

...

Robin.Collection

...

Нет

...

Значение первичного ключа

...

Значение первичного ключа записи таблицы, данные из которой требуется получить

...

Robin.Dictionary

...

Да

...

Данные записи

...

Извлеченная запись в виде словаря, где ключи - это указанные в запросе имена столбцов

...

Robin.Dictionary

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

Отсутствуют.

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

Задача

Подключиться к базе данных и извлечь данные по одной строке таблицы по столбцам company_name и inn (id=9).

Image Removed

Решение

Воспользоваться действиями "Стандартное подключение", "Извлечь запись". 

Реализация

...

Action group: Databases

...

Description

The action retrieves a record from the specified database table by the value of its primary key

Action icon

Image Added

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
DB contextConnection context to the selected databaseRobin.DbContextDatabase contextYes
Table nameTable nameRobin.String
Yes
Table fieldsFields of the table as a collection, the data of which you want to getRobin.Collection
No
Primary key valueThe value of the primary key of the table record from which you want to get dataRobin.Dictionary
Yes
Results
Data recordThe retrieved dictionary entry, where keys are the column names specified in the queryRobin.Dictionary

Special conditions of use

None.


Example of use 

Task

Connect to the database and retrieve data on one row of the table by columns AGENT_NAME, WORKING_AREA, COMMISSION, PHONE_NO and COUNTRY (ID=5).

image2024-2-12_11-34-31.pngImage Added

Solution

Use "Connect Standard Db", "Select Record", "Data entry form" actions

Implementation

  1. Assemble a robot scheme consisting of actions:
    Image Added
  2. Fill in the parameters for the "Connect Standard DB" action. 
    In the "Database type" field, select the appropriate database to which you want to connect. 
    Specify the database login and password. 
    The server host can be specified either by the IP of the host where the database is installed or by the host name. 
    Specify the server port, as well as the database name. 
    In the "Timeout" field, the value is calculated in seconds. 
    In the "Parameters" field specify additional parameters for connection, usually these are parameters that relate to security. Parameters are specified in the form of a dictionary. 

    Learn more about the "Transaction isolation level" parameter. Sequential database operations can be divided into transactions. A transaction is a group of operations that represent a certain boolean unit of work with the database. For example, it is necessary to perform several operations with a table in order to update the data in it. If an error occurs, you can roll back the transaction, i.e. a group of operations made, so that you don't have to figure out at which step this error occurred. 

    If the "Transaction isolation level" checkbox is activated, a part of the executed queries to the database will be in the form of transactions. Image Added
  3. Set the parameters for the "Select Record" action. 
    Image Added
    In the "Table fields" field specify the fields for which you want to get data
    Image Added
    In the "Primary key value" field, specify row 5
     Image Added
  4. Set the parameters for the "Data entry form" action. 
    Image Added
  5. Click on the "Start" button in the top panel. 

Result

The program robot completed successfully.

Image Added

The data from line 5 has been extracted. 

Image Added

...

Результат:

Программный робот отработал успешно. Данные из строки 9 по столбацам company_name и inn извлечены. 

Image Removed

Image Removed