Skip to main content
Version: 5.6

DB Select

The DB Select transfer object retrieves one or more records from a table or database view. The transfer object thus serves as a data source.

Dialog Overview

DB Select transfer object dialog

General Properties

PropertyDescription
DB ConnectionAll relational database connections created in the Plug-ins area are available for selection here. If your desired database connection is not listed, you can create it in the Plug-ins area as Microsoft SQL Server, Oracle, SAP HANA, ODBC, OLE DB, MySQL, or PostgreSQL.
TableTable or database view from which data is read.
Available ColumnsColumns present in the table that have not yet been used.
Used ColumnsColumns that are displayed as elements of the transfer object and are therefore available for the query.

The distinction between available and used columns serves to provide clarity in the design area. Move columns by double-clicking the column name or using the <, >, <<, and >> buttons. Use the Up and Down buttons to sort the used columns.

Filters

The filters are configured graphically. The OPC Router generates the corresponding database query at runtime based on this configuration. The values for the filters can be filled dynamically at runtime or defined using variables during the design phase.

Filter tab of the DB Select transfer object

PropertyDescription
FilterDisplays filters and filter groups graphically.
LinkDefines the AND and OR operators between filters and filter groups.
ColumnColumn used for filtering.
Comparison OperatorOperator for comparing values.
PreviewDisplays the resulting query as an SQL statement, for example WHERE (TIMESTAMP > ?) AND (VALUE = ?).

In the configuration interface, you see the filter criteria as elements. Drag connection arrows from any other transfer objects to the filter criteria to populate them. For timestamp filters, relative values can also be used, for example -1d for the previous day’s date.

An explanation of the various filter operators can be found here.

Query

Query tab of the DB Select transfer object

PropertyDescription
Sort OrderAscending or descending.
Sort by ColumnColumn by which the query result is sorted.
Do Not Modify RecordsOnly available for queries from tables. The transferred records are not modified.
Mark records after transferOnly available for queries from tables. In a corresponding column of the source table, 1 is entered for each successfully transferred record and 2 for a failed transfer.
Column to markOnly available for queries from tables. Column in which the marker for a successful or failed data transfer is entered.
Marker valuesValues entered into the marker column. The marker values must be unique.
Count failed transfersCounts the failed transfers.
Delete records after successful transferOnly available for queries from tables. Transferred records can also be deleted from the table.
Abort transfer (if query result is empty)Aborts the data transfer if the query result is empty.
Trigger read error (if query result is empty)Aborts the data transfer if the query result is empty and triggers error logging.
Return empty recordReturns an empty record if the query result is empty.
Limit number of records toTransfers only the number of records specified here. Sorting must be set accordingly.
note

For Mark records after transfer, a simple primary key on the numeric ID column is required in the relevant table.

note

If you use Count failed transfers, select the column in which the number of failed transfers is to be counted under Error column.

warning

If you enable Delete records after successful transfer, the records in the source table will be permanently deleted.

Notes

Use DB Select only in conjunction with filters to prevent the entire table from being loaded into memory. For example, when using transfer flags, filter by <transferflag> <> 1.

Mark transferred records using a dedicated transfer flag column. You can find the technical details on this in the Transfer Status Trigger as well as under Examples and Concepts.

To optimize performance, you can filter by the transfer flag column, for example Transferflag = 0 or Transferflag = 2.