Action group: Databases
Executes a query to retrieve data from a table.
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
DB context | Connection context to the selected database | Robin.DbContext | Database context | Yes |
Query template | Query template | Robin.String | Yes | |
Parameters list | A collection of parameter values to be substituted into a query | Robin.Collection | No | |
With header | If the value is «true», the row with the table header will be rendered separately and will not be included in the rows with the contents of the table. | Robin.Boolean | true | No |
Rename duplicate headers | If the value is «true», in the header of the table value that the actions return as a result, indexes will be added to the same column names. Numbering starts from 1. | Robin.Boolean | true | No |
Results | ||||
Result | Statement execution result as a data table | Robin.DataTable |
This action executes the query. The Call Stored Procedure action is used to execute stored procedures.
Parameters are set via "Parameter list". Do not insert them into the body of the request - this leads to errors.
For the "Rename duplicate headers" checkbox:
Example of use
Query the database and save the result to a CSV table. Query the developer name with ID=1.
Use the actions "Connect Standard Db", "Execute Sql Statement", "Table to CSV".
Assemble a robot scheme consisting of actions:
Set the parameters for the "Connect Standard Db" action.
Configure parameters for the "Execute Sql Statement" action. In the "DB context" field specify the context of connection to the database. In the "Query template" field, specify the SQL expression (request the developer's name with ID=1). It may contain question marks, as in this case. And then the "Parameters list" field must be filled in.
These parameters will be substituted in place of the question marks. The fields contain the following data:
The program robot completed successfully.
Data from the database is retrieved and written to a CSV table.