Advanced source expression building techniques
- Last UpdatedJan 24, 2023
- 2 minute read
- PI System
- RtReports 5.0
- Visualization
Additional operators and XPath functions allow you to build advanced source expressions.
Navigate the data journal tree
You can build a source expression to move from child to parent nodes in the tree hierarchy using the notation .
To navigate from a UnitBatchJournal to a BatchJournal for the BatchID element, the syntax would be:
../../BatchID
Select an element by position
To select the last JournalEvent in the data journal, the XPath function syntax would be:
BatchJournal/UnitBatchJournals/UnitBatchJournal/JournalEvents/JournalEvent[last()]
Select an element by property
To included only those UnitBatchJournal objects that have a PIUnitName element that starts with TRA, the XPath function syntax would be:
BatchJournal/UnitBatchJournals/UnitBatchJournal[starts-with(PIUnitName,”TRA”)]
Apply TraceSet data in source expressions
The TraceSet element in the data journal is unique because it includes descriptive information about the data. You can obtain individual values from a TraceSet data journal object by specifying particular result definition types.
|
Summary result definition type |
Source expression syntax |
|---|---|
|
Total |
TraceSet/Events/Properties/Property[(@Descriptor='22000')] |
|
Minimum |
TraceSet/Events/Properties/Property[(@Descriptor='22001')] |
|
Maximum |
TraceSet/Events/Properties/Property[(@Descriptor='22002')] |
|
Standard Deviation |
TraceSet/Events/Properties/Property[(@Descriptor='22003')] |
|
Range |
TraceSet/Events/Properties/Property[(@Descriptor='22004')] |
|
Average |
TraceSet/Events/Properties/Property[(@Descriptor='22005')] |
|
Mean |
TraceSet/Events/Properties/Property[(@Descriptor='22006')] |
|
Percent Good |
TraceSet/Events/Properties/Property[(@Descriptor='22007')] |
|
Start Value |
TraceSet/Events/Properties/Property[(@Descriptor='22008')] |
|
End Value |
TraceSet/Events/Properties/Property[(@Descriptor='22009')] |
|
Maximum Time |
TraceSet/Events/Properties/Property[(@Descriptor='22010')] |
|
Minimum Time |
TraceSet/Events/Properties/Property[(@Descriptor='22011')] |
Obtain TraceSet descriptors
To obtain the PI Tag Name, PI Tag Descriptor, and PI Tag Engineering Units values from the element, the syntax would be:
-
PI Tag Name
TraceSet/Properties/Property[(@Descriptor='12')]
-
PI Tag Descriptor
TraceSet/Properties/Property[(@Descriptor='14')]
-
PI Tag Engineering Units
TraceSet/Properties/Property[(@Descriptor='17')]
Differentiate among TraceSet results
If you define multiple data sources within a result definition, your data journal might contain several TraceSet elements with the same Result element. This example will show how to differentiate between them.
To select the TraceSet by name, specifically the Result.Tag TraceSet, the syntax would be:
Results/Result/Value/TraceSet[Name=”Result.Tag”]
To select the TraceSet by position, specifically the second TraceSet element:
Results/Result/Value/TraceSet[position()=2]