mgerges

RDBMS PI Interface - Filter output (PI-to-RDB) values

Discussion created by mgerges on Nov 6, 2013
Latest reply on Nov 6, 2013 by mgerges

Hi guys,

 

I'm currently reading about the RDBMS PI interface as I'm evaluating it's use for our project.

 

I don't have the interface installed on our PI server so I can play with it, but I would like to know if anyone has seen any cases where the output results from PI (to be inserted in an RDB table) are filtered on the basis of a condition (any condition).

 

To make this clearer, here's an example:

 

If your RDB table "PI_DATA" is structured as per below:

  • Column 1 - TAGNAME | varchar
  • Column 2 - TIMESTAMP | float32
  • Column 3 - VALUE | float32

and your SQL statement in file "PI_OUT.SQL" is: INSERT INTO PI_DATA (TAGNAME, TIMESTAMP, VALUE) VALUES (?,?,?);

 

and you PI output tag "PItoRDB_Tag1" is setup with the following attributes:

  • SourceTag=tag1
  • ExDesc=P1=AT.TAG P2=TS P3=VL
  • IntrumentTag=PI_OUT.SQL

when the SQL statement is ran, it will output all the timestamps and values in the PI archives for tag1.

 

My question is, is there a way we can amend the SQL statement to say filter out any timestamps from a week ago, and only output timestamps from the past week, that will then be inserted in our table PI_DATA?

Eg. INSERT INTO PI_DATA (TAGNAME, TIMESTAMP, VALUE) VALUES (?,?,?) WHERE TIMESTAMP >= TODAY()-7; ?

 

I know the above WHERE clause in the SQL statement is invalid, thus my question :)

 

Thanks a lot guys!

 

Cheers,

Mario

Outcomes