Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFListData.Summaries Method

  • Last UpdatedNov 18, 2025
  • 8 minute read
AFListData.Summaries Method
Returns several summaries over a time range for each interval within the range for each AFAttribute in the list.

Namespace:  OSIsoft.AF.Data
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public IEnumerable<IDictionary<AFSummaryTypes, AFValues>> Summaries(
	AFTimeRange timeRange,
	AFTimeSpan summaryDuration,
	AFSummaryTypes summaryTypes,
	AFCalculationBasis calculationBasis,
	AFTimestampCalculation timeType,
	PIPagingConfiguration pagingConfig
)
Public Function Summaries ( 
	timeRange As AFTimeRange,
	summaryDuration As AFTimeSpan,
	summaryTypes As AFSummaryTypes,
	calculationBasis As AFCalculationBasis,
	timeType As AFTimestampCalculation,
	pagingConfig As PIPagingConfiguration
) As IEnumerable(Of IDictionary(Of AFSummaryTypes, AFValues))

Dim instance As AFListData
Dim timeRange As AFTimeRange
Dim summaryDuration As AFTimeSpan
Dim summaryTypes As AFSummaryTypes
Dim calculationBasis As AFCalculationBasis
Dim timeType As AFTimestampCalculation
Dim pagingConfig As PIPagingConfiguration
Dim returnValue As IEnumerable(Of IDictionary(Of AFSummaryTypes, AFValues))

returnValue = instance.Summaries(timeRange, 
	summaryDuration, summaryTypes, calculationBasis, 
	timeType, pagingConfig)
public:
IEnumerable<IDictionary<AFSummaryTypes, AFValues^>^>^ Summaries(
	AFTimeRange timeRange, 
	AFTimeSpan summaryDuration, 
	AFSummaryTypes summaryTypes, 
	AFCalculationBasis calculationBasis, 
	AFTimestampCalculation timeType, 
	PIPagingConfiguration^ pagingConfig
)
member Summaries : 
        timeRange : AFTimeRange * 
        summaryDuration : AFTimeSpan * 
        summaryTypes : AFSummaryTypes * 
        calculationBasis : AFCalculationBasis * 
        timeType : AFTimestampCalculation * 
        pagingConfig : PIPagingConfiguration -> IEnumerable<IDictionary<AFSummaryTypes, AFValues>> 

Parameters

timeRange
Type: OSIsoft.AF.TimeAFTimeRange
The bounding time range over which the summary intervals are computed.
summaryDuration
Type: OSIsoft.AF.TimeAFTimeSpan

The duration of each summary interval. If specified in hours, minutes, seconds, or milliseconds, the summary durations will be evenly spaced UTC time intervals. Longer interval types are interpreted using wall clock rules and are time zone dependent. For example, an interval created with the string "24h" means using an evenly spaced 24 UTC hour interval between each event. On the other hand, an interval created with the string "1d" would return an interval shorter or longer than 24 hours if the interval encompasses a Daylight Savings Time change.

When a positive duration is specified, the summary calculation begins at the earliest bounding time in the timeRange and applies the duration repeatedly in time ascending direction to generate the summary intervals.

If a negative duration is specified, the summary calculation begins at the latest bounding time in the timeRange and applies the duration repeatedly in time descending direction to generate the summary intervals. Note that the order of values returned will still be reflected by the timeRange, regardless of the summary duration sign.

summaryTypes
Type: OSIsoft.AF.DataAFSummaryTypes
A flag which specifies one or more summaries to compute for each interval over the time range
calculationBasis
Type: OSIsoft.AF.DataAFCalculationBasis
Specifies the method of evaluating the data over the time range.
timeType
Type: OSIsoft.AF.DataAFTimestampCalculation
A flag indicating what how to calculate a timestamp for each interval.
pagingConfig
Type: OSIsoft.AF.PIPIPagingConfiguration
Contains the paging configuration parameters for the request.

Return Value

Type: IEnumerableIDictionaryAFSummaryTypes, AFValues

An enumerable of IDictionaryTKey, TValue for each AFAttribute in the list. The results are not guaranteed to match the order of the AFAttributeList, and duplicate attributes in the list will not produce a duplicate result. The results can be mapped back to the corresponding attribute using the Attribute property on each result.

The order of the results are predictable; however, if you need the results in the same order as the attribute list, then consider using a dictionary keyed by attribute to construct a list in the same order.

The attributes in the list are broken up by data reference. If the data reference supports bulk calls, then the bulk call is used to improve performance and reduce roundtrips to the server. PI Point attributes are then broken up a second time by their corresponding PI Data Archive. A bulk call is made against each PI Data Archive in parallel. The results are made available as they are returned from the PI Data Archive in the order that the bulk calls were made.

The following example shows a list of attributes including duplicates from three different PI Data Archives, and two table lookups:

AttributePI Data ArchiveData Reference
Lobby Room TemperatureContosoPI Point
Lobby Room TemperatureNorthwindPI Point
Target Lobby Room TemperatureN/ATable Lookup
Lobby Room TemperatureContosoPI Point
Lobby Room TemperatureAdventureWorksPI Point
Maximum Lobby Room TemperatureN/ATable Lookup
Kitchen Room TemperatureContosoPI Point

This table shows the order that the results would be returned:

AttributePI Data ArchiveData Reference
Lobby Room TemperatureContosoPI Point
Kitchen Room TemperatureContosoPI Point
Lobby Room TemperatureNorthwindPI Point
Lobby Room TemperatureAdventureWorksPI Point
Target Lobby Room TemperatureN/ATable Lookup
Maximum Lobby Room TemperatureN/ATable Lookup

Since the first attribute is on the Contoso PI Data Archive, it is the first PI Data Archive to receive a bulk call; therefore, all Contoso attributes will be returned first. Duplicate attributes do not produce a duplicate result, so the duplicate Contoso Lobby Room Temperature does not produce a second return value. After the Contoso attributes have been returned, the Northwind attributes are returned followed by the AdventureWorks attributes.

After attributes supporting bulk calls have been returned, the remaining attributes are iterated and evaluated, so the table lookups are returned last in the order they were in the original list.

Important note Important
Several factors can cause the values to come back in a different order, so a dictionary should be used to restructure the results if order is important. If an error occurs or the request range spans multiple element versions, the SDK will fall back to an iterative approach. This would cause the PI Point attributes to be returned in the same order as they were in the list. Finally, calls that include a filter expression that resolve differently for each attribute such as "'.' > 1" will also cause the SDK to fall back to an iterative approach.

Exceptions

ExceptionCondition
ArgumentOutOfRangeException The summaryTypes cannot be None.
OperationCanceledExceptionWhen an error occurs that prevents the operation from proceeding. Check the Error property on the pagingConfig object for more specific error information.
ArgumentNullExceptionWhen pagingConfig is .

Remarks

The following table illustrates the interaction between timeRange and summaryDuration with the timestamp summary calculations and order of returned values for each summary type.

Time RangeSummary DurationSummaries returned in AFValues
Ascending (Y to T)Positive (5h)Y to Y+5h, Y+5h to Y+10h, Y+10h to y+15h, Y+15h to Y+20h
Descending (T to Y)Positive (5h)Y+15h to Y+20h, Y+10h to Y+15h, Y+10h, Y+5h to Y+10h, Y to Y+5h
Ascending (Y to T)Negative (-5h)T-20h to T-15h, T-15h to T-10h, T-10h to T-5h, T-5h to T
Descending (T to Y)Negative (-5h)T-5h to T, T-10h to T-5h, T-15h to T-10h, T-20 to T-15h

Time-weighted totals are computed by integrating the rate tag values over the requested time range. If some of the data are bad in the time range, the calculated total is divided by the fraction of the time period for which there are good values. Mathematically, this approach is equivalent to assuming that during the period of bad data, the tag takes on the average values for the entire calculation time range. The use can use the PercentGood summary to determine if the calculation results are suitable for the application's purposes.

Tip Tip
Results are available for enumeration as they are returned from the data source for better performance.

Important note Important
The returned enumerable collection can be enumerated one time. As the collection is enumerated, the internal data structures are disposed. Any attempt to reset or enumerate a second time will result in an exception.

Note Notes to Callers
This method, property, or class is not available in the legacy .NET 3.5 version of the SDK.

Note Notes to Callers
This call might use a background task to complete some of its work. See the Threading Overview for some matters to consider when execution transitions to another thread.

Examples

// Holds the results keyed on the associated attribute
var resultsMap = new Dictionary<AFAttribute, AFValues>();

// Results should be sent back for 100 tags in each page.
PIPagingConfiguration config = new PIPagingConfiguration(PIPageType.TagCount, 100);

try
{
    var listResults = attributeList.Data.Summaries(timeRange, timeSpan,
        AFSummaryTypes.Average, AFCalculationBasis.TimeWeighted,
        AFTimestampCalculation.Auto, config);

    foreach (IDictionary<AFSummaryTypes, AFValues> attributeResults in listResults)
    {
        // Get average values from the result dictionary
        AFValues attributeValues = attributeResults[AFSummaryTypes.Average];
        AFAttribute attr = attributeValues.Attribute;

        // Map the results back to the attribute
        resultsMap[attr] = attributeValues;
    }
}
catch (OperationCanceledException)
{
    // Errors that occur during bulk calls get trapped here
    // The actual error is stored on the PIPagingConfiguration object
    Console.WriteLine(config.Error.Message);
}
catch (Exception otherEx)
{
    // Errors that occur in an iterative fallback method get trapped here
    Console.WriteLine(otherEx.Message);
}
' Holds the results keyed on the associated attribute
Dim resultsMap As New Dictionary(Of AFAttribute, AFValues)

' Results should be sent back for 100 tags in each page.
Dim config As New PIPagingConfiguration(PIPageType.TagCount, 100)

Try

    Dim listResults As IEnumerable(Of IDictionary(Of AFSummaryTypes, AFValues)) =
        attributeList.Data.Summaries(timeRange, timeSpan, AFSummaryTypes.Average,
        AFCalculationBasis.TimeWeighted, AFTimestampCalculation.Auto, config)

    For Each attributeResults As IDictionary(Of AFSummaryTypes, AFValues) In listResults

        ' Get average values from result dictionary
        Dim attributeValues As AFValues = attributeResults(AFSummaryTypes.Average)
        Dim attr As AFAttribute = attributeValues.Attribute

        ' Map the results back to the attribute
        resultsMap(attr) = attributeValues
    Next

Catch canceledEx As OperationCanceledException

    ' Errors that occur during bulk calls get trapped here
    ' The actual error is stored on the PIPagingConfiguration object
    Console.WriteLine(config.Error.Message)

Catch otherEx As Exception

    ' Errors that occur in an iterative fallback method get trapped here
    Console.WriteLine(otherEx.Message)
End Try

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in