AFResult Class
- Last UpdatedNov 18, 2025
- 8 minute read
- PI System
- AF SDK 2024 R2
- Developer
An AFResult represents the result of a model analysis for a specific
attribute specified by the Attribute property.

Inheritance Hierarchy
Namespace: OSIsoft.AF.Analysis
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFResult : AFObject, IComparable<AFResult>, IAFTrace
<SerializableAttribute> Public NotInheritable Class AFResult Inherits AFObject Implements IComparable(Of AFResult), IAFTrace Dim instance As AFResult
[SerializableAttribute] public ref class AFResult sealed : public AFObject, IComparable<AFResult^>, IAFTrace
[<SealedAttribute>] [<SerializableAttribute>] type AFResult = class inherit AFObject interface IComparable<AFResult> interface IAFTrace end
The AFResult type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Adjustments |
Gets the collection of AFAdjustments that are associated with
this AFResult that keep track of all the changes to attribute result
values used during an analysis.
| |
| Attribute |
This read-only property returns the attribute of an element, the
value of which is represented by this result.
| |
| Case |
This read-only property returns the case that owns this object.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| ID |
Read-only property that provides a unique identifier for the object to be used for
quick access that is not dependent upon the index.
(Inherited from AFObject.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsAdjusted |
This property indicates whether the result for the case run has been adjusted.
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsOutput |
This property indicates whether the result for the case run is an output value.
| |
| Name |
The read-only property returns the name of the elements and attributes
of this result.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) | |
| Value |
This read-only property represents the result value of the case for
the element's attribute.
|
Methods
| Name | Description | |
|---|---|---|
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| 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 AFObject.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| GetPath(AFEncodeType, AFObject) |
Returns the path to the object relative from another object,
using the name and/or id as specified
by encodeType.
(Inherited from AFObject.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsTraced |
Indicates if a specified level is being traced.
| |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| 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 result is normally created when a model analysis is run, but you can
adjust it using the AFAdjustments.Add
method within a case. Case result values and adjustments 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.