Update three tags from a single row (group distribution)
- Last UpdatedNov 18, 2022
- 1 minute read
- PI System
- Interfaces
The following example updates three PI points from a single database row that contains
columns with different values.
SELECT timestamp, temperature, 0, pressure, 0, level, 0
FROM table3
WHERE key1 LIKE 'Tank1' AND timestamp > ? ORDER BY timestamp ASC;
Configure the target PI points with the following settings.
|
Point Attribute |
Description |
Setting |
|---|---|---|
|
ExDesc |
Placeholders and options |
P1=TS |
|
Location2 |
First row/all rows |
1 (Processes all rows) |
|
Location3 |
Data distribution strategy |
Point Tank1_Temperature: 2 Point Tank1_Pressure: 4 Point Tank1_Level: 6 |
|
Location4 |
Scan class |
1 |
|
Location5 |
Exception reporting |
0 (Exception reporting is enabled) |
|
InstrumentTag |
Name of the SQL file |
Example3.SQL |
|
PointType |
Data type of PI point |
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 |
|
temperature |
Real |
Number-Single Precision |
|
pressure |
Real |
Number-Single Precision |
|
level |
Real |
Number-Single Precision |
|
key1 |
Varchar(255) |
Text(255) |
If the query returned two rows confining values (42, 20, 300) and (43, 21, 310), the
following table shows how the values get assigned to PI points.
|
Timestamp |
Point Tank1_Temperature |
Point Tank1_Pressure |
Point Tank1_Level |
|---|---|---|---|
|
20-Oct-2015 08:15:00 |
42 |
20 |
300 |
|
20-Oct-2015 08:30:00 |
43 |
21 |
310 |