AFResults Class
- Last UpdatedNov 18, 2025
- 9 minute read
- PI System
- AF SDK 2024 R2
- Developer
The collection of AFResult objects for an attribute
created during the run of a case is maintained by the AFCase.

Inheritance Hierarchy
Namespace: OSIsoft.AF.Analysis
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public sealed class AFResults : AFCollection<AFResult>, IAFTrace
Public NotInheritable Class AFResults Inherits AFCollection(Of AFResult) Implements IAFTrace Dim instance As AFResults
public ref class AFResults sealed : public AFCollection<AFResult^>, IAFTrace
[<SealedAttribute>] type AFResults = class inherit AFCollection<AFResult> interface IAFTrace end
The AFResults type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Case |
This property returns the AFCase object which owns the
result.
| |
| Count |
Gets the number of items actually contained in the collection.
(Inherited from AFCollectionT.) | |
| CountInputs |
Returns the number of inputs contained in the collection of results.
| |
| CountInputsBad |
Returns the number of inputs with bad status values contained in the collection of results.
| |
| CountOutputs |
Returns the number of outputs contained in the collection of results.
| |
| CountOutputsBad |
Returns the number of outputs with bad status values contained in the collection of results.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFCollection.) | |
| IsDeleted |
This read-only property indicates whether the owner of the collection has been deleted.
(Inherited from AFCollection.) | |
| ItemGuid | Returns the item in the collection associated with the passed in ID. (Inherited from AFCollectionT.) | |
| ItemInt32 | Returns the item located at the passed in index. (Inherited from AFCollectionT.) | |
| ItemAFAttribute |
This property returns the specified object from the collection by AFAttribute.
| |
| ItemIdentity |
This read-only property specifies the identity of the objects within the collection.
(Inherited from AFCollection.) | |
| PISystem |
This read-only property allows access to the PISystem
associated with this collection.
(Inherited from AFCollection.) |
Methods
| Name | Description | |
|---|---|---|
| Add |
Adds an object to the end of the collection.
(Inherited from AFCollectionT.) | |
| Clear |
Removes all items from the collection.
(Inherited from AFCollectionT.) | |
| Contains(Guid) |
This method determines whether the collection contains a specific item referenced by id.
(Inherited from AFCollectionT.) | |
| Contains(T) |
This method determines whether the collection contains a specific item.
(Inherited from AFCollectionT.) | |
| CopyTo |
Copies the entire collection to a compatible one-dimensional Array,
starting at the specified index of the target array.
(Inherited from AFCollectionT.) | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetEnumerator |
Returns an enumerator that iterates through the collection.
(Inherited from AFCollectionT.) | |
| GetHashCode |
Gets the hash code for this instance of the object which is suitable for use in hashing
algorithms and data structures like a hash table.
(Inherited from AFCollection.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IndexOf |
Searches for the specified object and returns the zero-based index of the first
occurrence within the entire collection.
(Inherited from AFCollectionT.) | |
| IsTraced |
Indicates if a specified level is being traced.
| |
| Remove(Guid) |
Removes the item with the specified id from the collection.
(Inherited from AFCollectionT.) | |
| Remove(T) |
Removes the first occurrence of a specific object from the collection.
(Inherited from AFCollectionT.) | |
| RemoveAt |
Removes the item at the specified index of the collection.
(Inherited from AFCollectionT.) | |
| Sort |
Sorts the items in the entire collection using the default comparer.
(Inherited from AFCollectionT.) | |
| Sort(IComparerT) |
Sorts the items in the entire collection using the specified comparer.
(Inherited from AFCollectionT.) | |
| Sort(Int32, Int32, IComparerT) |
Sorts the items in a range of items in the collection using the specified comparer.
(Inherited from AFCollectionT.) | |
| ToString |
Returns a String that represents the current object.
(Inherited from AFCollection.) | |
| TraceData |
Output a data trace event.
| |
| TraceDetail |
Output a detail trace event.
| |
| TraceError |
Output an error trace event.
| |
| TraceEvent(AFTraceSwitchLevel, String) |
Output a trace event with a message.
| |
| TraceEvent(AFTraceSwitchLevel, String, Int32) |
Output a trace event with a message and a duration.
| |
| TraceEvent(AFTraceSwitchLevel, String, Object) |
Output a trace event as a formatted message with a variable number of arguments.
| |
| TraceInformation |
Output an information trace event.
| |
| TraceSummary |
Output a summary trace event.
| |
| TraceWarning |
Output a warning trace event.
|
Remarks
The collection is initialized after the
AFAnalysisRule.CollectInputs
method is called. The result is
updated during the run of the model analysis. Case results affect the
value returned from the
AFAttribute.GetValue Overload
methods when called with the AFCase as a context.
Examples
// This example will create a case, collect inputs, // and then display information on one of the results. // Note: This example assumes that there is a database called "Chocolate Milk Tutorial" // containing a Model named "ChocolateMilkModel", with a Model Analysis // named "Volume Balance" // Get the Database PISystems myPISystems = new PISystems(); AFDatabase myDB = myPISystems.DefaultPISystem.Databases["Chocolate Milk Tutorial"]; // Get the Model Analysis AFAnalysis myAnalysis = AFAnalysis.FindAnalyses(myDB, "ChocolateMilkModel::Volume Balance", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 1)[0]; // Create the Case AFCase myCase = myAnalysis.AddCase(); myCase.CollectInputs(); // Display the number of Inputs and Outputs along with the number of bad inputs and outputs Console.WriteLine("Total number of Results = {0}", myCase.Results.Count); Console.WriteLine("Total number of Inputs = {0}", myCase.Results.CountInputs); Console.WriteLine("Total number of Bad Inputs = {0}", myCase.Results.CountInputsBad); Console.WriteLine("Total number of Outputs = {0}", myCase.Results.CountOutputs); Console.WriteLine("Total number of Bad Outputs = {0}", myCase.Results.CountOutputsBad); // Make an Adjustment to the first Result myCase.Results[0].Adjustments.Add("Example creator", "This is an Adjustment to a Result", 25, myCase.Results[0].Attribute.DefaultUOM); // Display each result Console.WriteLine(); foreach (AFResult CurResult in myCase.Results) { Console.WriteLine("Name of Result = {0}", CurResult.Name); Console.WriteLine("Element represented by Result = {0}", CurResult.Attribute.Element.Name); Console.WriteLine("Attribute represented by Result= {0}", CurResult.Attribute.Name); Console.WriteLine("Value of Result = {0}", CurResult.Value.Value); Console.WriteLine(); }
' This example will create a case, collect inputs, ' and then display information on one of the results. ' Note: This example assumes that there is a database called "Chocolate Milk Tutorial" ' containing a Model named "ChocolateMilkModel", with a Model Analysis ' named "Volume Balance" ' Get the Database Dim myPISystems As New PISystems Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases("Chocolate Milk Tutorial") ' Set the Model Analysis Dim myAnalysis As AFAnalysis = AFAnalysis.FindAnalyses(myDB, "ChocolateMilkModel::Volume Balance", AFSearchField.Name, AFSortField.Name, AFSortOrder.Descending, 1)(0) ' Create the Case Dim myCase As AFCase = myAnalysis.AddCase myCase.CollectInputs() ' Display the number of Inputs and Outputs along with the number of bad inputs and outputs Console.WriteLine("Total number of Results = {0}", myCase.Results.Count) Console.WriteLine("Total number of Inputs = {0}", myCase.Results.CountInputs) Console.WriteLine("Total number of Bad Inputs = {0}", myCase.Results.CountInputsBad) Console.WriteLine("Total number of Outputs = {0}", myCase.Results.CountOutputs) Console.WriteLine("Total number of Bad Outputs = {0}", myCase.Results.CountOutputsBad) ' Make an Adjustment to the first Result myCase.Results(0).Adjustments.Add("Example creator", "This is an Adjustment to a Result", 25, myCase.Results(0).Attribute.DefaultUOM) ' Display each result Console.WriteLine() Dim CurResult As AFResult For Each CurResult In myCase.Results Console.WriteLine("Name of Result = {0}", CurResult.Name) Console.WriteLine("Element represented by Result = {0}", CurResult.Attribute.Element.Name) Console.WriteLine("Attribute represented by Result= {0}", CurResult.Attribute.Name) Console.WriteLine("Value of Result = {0}", CurResult.Value.Value) Console.WriteLine() Next CurResult
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.