Lesson 5: Hints and tips
- Last UpdatedJan 15, 2026
- 1 minute read
- PI System
- AF SDK 3.2.0
- PI Server
CaptureValues() is used only on closed event frames, which is an event frame with an EndTime that occurs before AFTime.MaxValue. Event frames that are not closed have values that can still change. If the CaptureValues() method is called and the EndTime has not been set, then an exception is thrown.
Use the template NamingPattern property to define the event frame names. To obtain an understanding of how the template works, try setting it in PI System Explorer first before using it in the AF SDK. For example, try the following template:
TEMPLATE%-%ELEMENT%-%STARTTIME:yyyy-MM-dd%-EF*
To configure the event frame attribute to report an average, set the data reference to a PI Point data reference. Use the following ConfigString:
.\Elements[.]|Energy Usage;TimeRangeMethod=Average
The ConfigString shown above configures the Average Energy Usage attribute to report the average of the primary referenced element's Energy Usage over the event frame's time range.