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

AF SDK Reference

AFResult Class

  • Last UpdatedNov 18, 2025
  • 8 minute read
AFResult Class
An AFResult represents the result of a model analysis for a specific attribute specified by the Attribute property.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AnalysisAFResult

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

  NameDescription
Public property
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.
Public property
Attribute
This read-only property returns the attribute of an element, the value of which is represented by this result.
Public property
Case
This read-only property returns the case that owns this object.
Public property
Database
This read-only property returns the AFDatabase where this object is defined.
Public property
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.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
IsAdjusted
This property indicates whether the result for the case run has been adjusted.
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsOutput
This property indicates whether the result for the case run is an output value.
Public property
Name
The read-only property returns the name of the elements and attributes of this result.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Public property
Value
This read-only property represents the result value of the case for the element's attribute.

Methods

  NameDescription
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public method
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.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
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.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
IsTraced
Indicates if a specified level is being traced.
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
TraceData
Output a data trace event.
Public method
TraceDetail
Output a detail trace event.
Public method
TraceError
Output an error trace event.
Public method
TraceEvent(AFTraceSwitchLevel, String)
Output a trace event with a message.
Public method
TraceEvent(AFTraceSwitchLevel, String, Int32)
Output a trace event with a message and a duration.
Public method
TraceEvent(AFTraceSwitchLevel, String, Object)
Output a trace event as a formatted message with a variable number of arguments.
Public method
TraceInformation
Output an information trace event.
Public method
TraceSummary
Output a summary trace event.
Public method
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.

Version Information

AFSDK


See Also

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