Retrieve interpolated values using Simplified Asset Database E-R Model
- Last UpdatedSep 29, 2022
- 1 minute read
- PI System
- PI OLEDB Enterprise 2019
- Developer
SELECT eh.Path + eh.Name + ea.Path + ea.Name ElementAttribute, i.*
FROM NuGreen.Asset.ElementHierarchy eh
INNER JOIN NuGreen.Asset.ElementAttribute ea ON ea.ElementID = eh.ElementID
CROSS APPLY NuGreen.Data.InterpolateRange
(
ea.ID
/*ElementAttributeID*/,
DATE('*') - TIME('1h')
/*StartTime*/,
DATE('*')
/*EndTime*/,
TIME('10m')
/*TimeStep*/
) i
WHERE eh.Path LIKE N'\NuGreen\Little Rock\Extruding Process\%'
AND eh.Name LIKE N'B-%'
AND ea.Name LIKE N'%Flow'
OPTION (FORCE ORDER)
Above query retrieves interpolated values through InterpolateRange Table-Valued Function (TVF), which performs calculation over the specified time interval with the specified time step.
Table-Valued Functions are typically incorporated into the query using the CROSS APPLY operator which invokes the Table-Valued Function for each row returned by join of tables which precede the TVF in the clause.