Insert record Version 11 (Java)

Action group: Databases


Description

The action adds the text (string) in the given DB table. 

Action icon

Parameters

Input parameters 

  1. DB context – connection context to the selected database.

  2. Table name – table name in DB.

  3. Insert data – data in the form of a dictionary for insertion into a table.

  4. List of primary key field names – list of primary key field names to be returned.

Output parameters

As a result we get the list of primary key values generated when inserting data for the field. 

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
DB contextConnection context to the selected databaseRobin.DbContextDatabase contextYes
Table nameTable nameRobin.String
Yes
Insert dataData in the form of a dictionary for insertion into a tableRobin.Dictionary
Yes
List of primary key field namesList of primary key field names to be returnedRobin.Collection
No
Results
List of primary key valuesList of primary key values generated as a result of inserting data for the fields specified in the «List of primary key field names» parameterRobin.Dictionary

Special conditions of use 

None.

Example of use

Task

Connect to the database and add data to the table (company_name and inn columns). Data: ООО "Ромашка", 5047053423


Solution

Use the "Connect Standard Db", "InsertRecord" actions. 

Implementation

  1. Assemble a robot scheme consisting of actions
  2. Set 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. 

    Read more about the "Transaction isolation level" parameter. The sequential database operations can be divided into transactions. A transaction is a group of operations that represent a certain boolean unit of working 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 do not have to figure out at what step this error occurred. 

    If the checkbox "Transaction isolation level" is activated, part of the performed queries to the database will be in the form of transactions. 


    image2024-2-12_11-23-8.png
  3. Set the parameters for the "Insert record" action. 
    In the "Insert data" field specify data in the form of a dictionary. 
    In the "List of primary key field names" field fill in the following manner:  
  4. Click the "Start" button in the top panel. 

Result

The program robot completed successfully. New text inserted in the table. 

  • Нет меток