Calculating with PI OLEDB

Discussion created by andreas on Jan 27, 2009
Latest reply on Oct 4, 2011 by AAugustine



PI OLEDB is often used to retrieve data from the PI system for a 3rd party application. However, sometimes the PI OLEDB provider can be used to solve special requests in PI that are more complicate using other tools. For example I had the task to sum up >500 tags for a customer. In SQL & PI OLEDB this is just one line:

SELECT Sum (Cast (value AS float32)) AS RVAL 
FROM piarchive..pisnapshot
WHERE tag LIKE '%100'

The query was executed in VB from an ACE module. Nice about this particular example is that the tags are based on a tag mask, so this can be extended to any criteria as well as it gets executed at runtime - automatically new tags are used when they are available.


Have you come across similar tasks where one line of SQL saved you from writing heaps of code?


share your experiences!