AFAttribute.GetValue Method (AFCase)
- Last UpdatedSep 18, 2024
- PI System
- AF SDK 2024
- Developer
This method gets the value for an attribute based upon the data reference configuration
and the specified AFCase context in the units of the
DefaultUOM for the attribute.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.0.1156
Syntax
public AFValue GetValue( AFCase caseContext )
Public Function GetValue ( caseContext As AFCase ) As AFValue Dim instance As AFAttribute Dim caseContext As AFCase Dim returnValue As AFValue returnValue = instance.GetValue(caseContext)
public: AFValue^ GetValue( AFCase^ caseContext )
member GetValue : caseContext : AFCase -> AFValue
Parameters
- caseContext
- Type: OSIsoft.AF.Analysis.AFCase
The case context to be used when getting the attribute's value. If the case context is null, then no context is used when getting the attribute's value. If the case context is not null and the case context is not supported by this attribute's configuration, as indicated by the SupportedContexts property, then the context will be changed to an AFTimeRange context represented by the case's start and end times.
Return Value
Type: AFValueReturns the AFValue for the attribute. If AFValue.IsGood returned by the data reference is true, then the returned value is converted to the proper UOM and Type.
Exceptions
Exception | Condition |
---|---|
InvalidCastException | Thrown when the conversion to the desired UOM or configured Type cannot be performed. |
Remarks
The data reference configuration specifies how to read the value of the attribute. The AFDataReference.UOM property specifies the actual UOM of the external data value referenced by this attribute.
When obtaining values for multiple attributes, consider using one of the AFAttributeList.GetValue Overload methods as it can perform more efficiently in many instances.
![]() |
---|
Once a value has been added to a case's result set, either through one of the AFCase.AddInput Overload methods or by setting its value with an AFCase context, then subsequent calls to GetValue with the same case context will not invoke the data reference but return the stored result value. |