The PIArchive..PICalc Table
PI ProcessBook features datasets. These allow an user to create a calculation that is calculated on the fly when somebody uses it in a Trend, Value, etc. In RtWebpart an administrator can create PI Calculation datasets but an ordinary user is not capable of doing this (you need to have access to the RtBaseline Services administration).
However, with the help of PI OLEDB we can create a simple relational dataset that takes the expression as a placeholder:
SELECT expr, time, CAST (value AS float32) result FROM piarchive..picalc WHERE expr = ? AND time > ? AND time < ? AND timestep = ?
This simple dataset can be used either with the expression defined at the level of the RtWebpart as well as the RtWebpart can consume the expression from another web part (for example the Form web part).
Note that the Relational Dataset first needs to be created in RtBaseline Services by the administrator. Because it contains a placeholder that allows end-users to use it with any expression in their Web Parts, it is only done once and then becomes a conveniences to end-users.
Read more in my next post AdHoc Calculations in RtWebparts (2)!