Click or drag to resize
OSIsoft, LLC

AFSearchSummary Method (String, AFSummaryTypes)

Summarizes the result of this search.

Namespace:  OSIsoft.AF.Search
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.6.195
Syntax
public AFSummaryResult Summary(
	string field,
	AFSummaryTypes summaryTypes
)

Parameters

field
Type: SystemString
The field that should be summarized.
summaryTypes
Type: OSIsoft.AF.DataAFSummaryTypes
The summaries that should be performed on the field.

Return Value

Type: AFSummaryResult
A result containing the requested summaries or an error if the summaries could not be performed.
Examples
// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
if (myPISystem == null)
    throw new InvalidOperationException("Default PISystem was not found.");
AFDatabase myDB = myPISystem.Databases[dbName];
if (myDB == null)
    throw new InvalidOperationException("Database was not found.");

// Create a search to find all the event frames created from the 'Event'
// template in the last year.
using (AFEventFrameSearch eventSearch = new AFEventFrameSearch(myDB, "EventFrameSearch", @"Template:'Event' Start:>'t-1y'"))
{
    eventSearch.CacheTimeout = TimeSpan.FromMinutes(10);
    // Summarize the Minimum, Average, and Maximum duration for items meeting the search criteria
    AFSummaryResult summaryResult = eventSearch.Summary("Duration", AFSummaryTypes.Minimum | AFSummaryTypes.Maximum | AFSummaryTypes.Average);
    Console.WriteLine("Minimum: {0}, Average: {1}, Maximum: {2}",
        summaryResult.SummaryResults[AFSummaryTypes.Minimum],
        summaryResult.SummaryResults[AFSummaryTypes.Average],
        summaryResult.SummaryResults[AFSummaryTypes.Maximum]);
}
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9
See Also
Enabling Operational Intelligence