Overview – Database Tag

OAS supports many different Tag data sources to allow you to move data in and out of OAS. This includes a variety of device drivers, such as Modbus, Allen Bradley, Siemens, OPC UA and OPC DA, as well as message based protocols and Cloud interfaces such as MQTT, Azure IoT, AWS IoT and Sparkplug B.

The Database Tag feature adds an additional type of Tag data source to OAS that allows you to integrate a Tag’s value with a database field. It supports many of the common database providers such as SQL Server, Oracle, MySQL, Cassandra, PostgreSQL, MariaDB, and SQLite

There is a clear difference between the Database Tag feature and other database driven features such as Data Historian, Alarm Logging and Recipe.

The Data Historian and Alarm Logging features are stand-alone configurations that will log one or more tags or alarms to a destination database. The aim is to create an independent data record of tag and alarm change history to be consumed by visualizations and external systems.

The Recipe feature is also a stand-alone feature and is designed to read a row of data from a database and copy this data into a batch of Tags. You can think of the data logging features as data storage mechanisms and the Recipe feature as data loader. The former only writes data and the latter only reads data.

The Database Tag feature on the other hand is not a stand-alone feature, but rather is a Tag data source that is configured as a device driver and then applied at the Tag level. It establishes a one-to-one, read and write relationship between a Tag’s value and a particular database entry as defined by a field name and a query. The driver configuration defines the parameters for the database connection including host and database name. This can then be applied to a Tag by setting the Tag’s Data Source to Database and then configuring the query parameters. The table or view name, field name, Where string and Order By string are all defined at the Tag level.

The following diagram shows an example Tag Col1Tag connected to a database with a table called ProcessData. In plain English, the query that is connected to the Tag’s value can be described as “get me the latest value of Col1 from the ProcessData table where the ProcessID is 1”. Since the Database Tag data source must always return a single value, even if the query returns more than one row, only the top row will be returned. By setting the Order By field to “Timestamp DESC”, the top row will be the latest row.

Sourcing Tag data from a database can be integrated with other OAS features as with any other data source type. For example, you can use Data Route to move your data into another set of Tags that are connected to a device or the Cloud. This allows you to create a data stream from your database and into another device or system. Another great use case is to use Database Tags to add dynamic data to your Open UIEngine screens, such as populating drop-down lists, taking input from text boxes and triggering write actions through button clicks.

👉 For transactional recording to a database see Getting Started – Data Logging.

👉 For transactional processing from a database see Getting Started – Recipes.