Write tag values to the DB (Batch transfer)

<< Click to Display Table of Contents >>

Manual > Monitoring system construction guide > Server logic construction >

Write tag values to the DB (Batch transfer)

overview

This section explains how to output tag data to a table in a database at any time.

 

Action used: Batch transfer(tag → ODBC) action

 

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

The above sample includes a SQL file (DDL) to generate the table. Use it as a reference when creating the table.

 

 

 

Operation check

This sample requires a database to be prepared. Once the database is prepared, please bring the sample server configuration file online from FA-Server (yellow arrow).

 

After going online, if you write TRUE to U01.F01.T01, the tag value will be written to the record in the target table.

 

(Example of output to a table)

c_action_0144

 

 

Setup Procedure

Tag configuration

 

1.Set tags.
 
c_action_0134
 

 

Tag Name

address

the purpose

U01.F01.T01

X0000

A tag that triggers an action

U01.F01.D0000~D0009

D0000 to D0009

Tags that output information

 

 


Action Settings

 

1.Register the Batch transfer (tag → ODBC) action "A01".
 
c_action_0135
 

2.Add a field to A01.
 
Drag and drop the tag into A01. This action allows you to register tags simply by dragging and dropping them.
 
c_action_0034
 
Field has been registered.
 
c_action_0137
 

3.Batch transfer (Tag → ODBC) Action property settings and table creation
 
Create the target table in the database.
In this sample example, a table is created with the following contents:

 

Table name: BATCH_TABLE

 

Batch Name Field: BATCH_NAME
Value quality field: BATCH_QUALITY
Timestamp field: BATCH_TIME
Value field: BATCH_VALUE
 
(Field setting example for SQLServer2017)

c_action_0138

 

The recommended data types for each connectable DBMS are described in "Database connection settings" in Appendix.

 

Next, set up the ODBC data source from the Batch transfer1 tab of the action. The ODBC setting procedure can be performed using the same operations for each ODBC. For ODBC settings, please refer to the description in "ODBC Settings" in the common settings of the action.

 

In this example, the data source is defined as "BATCH_TAG_ODBC". Also, specify the "BATCH_TABLE" created above as the table name to connect to.

 

c_action_0139
 

Next, in the Actions tab, set the field names to be associated with the output data.

 
c_action_0140
 

4.Writes the batch name to the database.
 
Batch transfer1 Click the "Create Manually" button on the tab to write the key batch name to the database.
 
c_action_0141
 
The following shows the batch name written correctly to the database (SQLServer2017 example):
 
c_action_0142

 
 


Event Settings

 

1.Create a Tag event to perform the action.

 

In this example, we will set the event to occur when U01.F01.T01 becomes TRUE.

 
c_action_0132

 
Set the execution action to "A01".
 
c_action_0365