Update tags from more rows in table marking the already-read rows (distribution by alias)
- Last UpdatedNov 18, 2022
- 1 minute read
- PI System
- Interfaces
Update tags from more rows in table marking the already-read rows (distribution by alias)
This example reads only previously-unread rows from the database. After reading the
rows, it sets the table’s rowRead column to 1 to indicate the rows have been read. In the ExDesc of each target tag, there is the /ALIAS=alias keyword defined.
SELECT timestamp,
alias,
value,
status
FROM table7
WHERE rowRead = 0 ORDER BY alias, timestamp;
UPDATE table1 SET rowRead = 1 WHERE (rowRead = 0 OR rowRead IS NULL);
Configure the target PI point with the following settings:
|
Point attribute |
Description |
Setting |
|---|---|---|
|
ExDesc |
Placeholders and options |
Target points: /ALIAS=T1_Temp /ALIAS=T1_Press /ALIAS=T1_Lev |
|
Location2 |
First row/all rows |
N/A for distribution |
|
Location3 |
Data distribution strategy (Distributor tag only) |
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: Example7.SQL |
|
PointType |
Data type of PI points |
Float32 |
In the RDBMS, create a table formatted as follows.
|
Column name |
SQL Server Data Type |
|---|---|
|
timestamp |
DateTime |
|
alias |
Varchar(255) |
|
value |
Real |
|
rowRead |
SmallInt |