Update tags from more rows in table since last scan (distribution by tagname)
- Last UpdatedNov 18, 2022
- 1 minute read
- PI System
- Interfaces
In this example, the database table includes a column (tagname) specifying the PI
point that is to be updated with the value.
SELECT timestamp,
tagname,
value,
status
FROM table4
WHERE timestamp > ? AND key1 LIKE 'Tank1' ORDER BY tagname, timestamp;
Configure the target PI point with the following settings:
|
Point Attribute |
Description |
Setting |
|---|---|---|
|
ExDesc |
Placeholders and options |
Distributor point: P1=LST |
|
Location2 |
First row/all rows |
N/A for distribution |
|
Location3 |
Data distribution strategy |
Distributor point: -1 Target points: 0 |
|
Location4 |
Scan class |
1 |
|
Location5 |
Exception reporting |
0 (Exception reporting is enabled) |
|
InstrumentTag |
Name of the SQL file (Distributor point only) |
Distributor point: Example4.SQL |
|
PointType |
Data type of PI points |
Float32 |
In the RDBMS, create a table formatted as follows:
|
Column name |
Column data type |
|
|---|---|---|
|
SQL Server data type |
Microsoft Access data type |
|
|
timestamp |
DateTime |
Date/Time |
|
value |
Real |
Number-Single Precision |
|
status |
Smallint |
Number (Whole Number) |
|
tagname, key1 |
Varchar(255) |
Text(255) |
Example result set
|
timestamp |
alias |
value |
status |
|---|---|---|---|
|
20-Oct-2015 08:15:00 |
Tank1_Temperature |
42 |
NULL |
|
20-Oct-2015 08:15:00 |
Tank1_Pressure |
20 |
NULL |
|
20-Oct-2015 08:15:00 |
Tank1_Level |
300 |
NULL |
Given this result set, the interface assigns values to PI points as follows:
|
Point |
Value assigned |
|---|---|
|
Tank1_Temperature |
42 |
|
Tank1_Pressure |
20 |
|
Tank1_Level |
300 |