Update a single tag with single value using static key matching
- Last UpdatedNov 18, 2022
- 1 minute read
- PI System
- Interfaces
This query updates a PI point by reading the first row from a table that contains
"Key123" in the key1 column. To ensure that only the first row of the result set is
used, set Location2 to 0.
SELECT timestamp, value, 0 FROM table1
WHERE key1 = ? ORDER BY timestamp ASC;
Configure the target PI point with the following settings:
|
Point attribute |
Description |
Setting |
|---|---|---|
|
ExDesc |
Placeholders and options |
P1="Key123" |
|
Location2 |
First row/all rows |
0 (Processes only the first row) |
|
Location3 |
Data distribution strategy |
0 (Single) |
|
Location4 |
Scan class |
1 |
|
Location5 |
Exception reporting |
0 (Exception reporting is enabled) |
|
InstrumentTag |
Name of the query file |
Example1.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 |
|
value |
Real |
Number-Single Precision |
|
key1 |
Varchar(50) |
Text(50) |