AFDataReference.GetValues Method
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public virtual AFValues GetValues( Object context, AFTimeRange timeRange, int numberOfValues, AFAttributeList inputAttributes, AFValues[] inputValues )
Public Overridable Function GetValues ( context As Object, timeRange As AFTimeRange, numberOfValues As Integer, inputAttributes As AFAttributeList, inputValues As AFValues() ) As AFValues Dim instance As AFDataReference Dim context As Object Dim timeRange As AFTimeRange Dim numberOfValues As Integer Dim inputAttributes As AFAttributeList Dim inputValues As AFValues() Dim returnValue As AFValues returnValue = instance.GetValues(context, timeRange, numberOfValues, inputAttributes, inputValues)
public: virtual AFValues^ GetValues( Object^ context, AFTimeRange timeRange, int numberOfValues, AFAttributeList^ inputAttributes, array<AFValues^>^ inputValues )
abstract GetValues : context : Object * timeRange : AFTimeRange * numberOfValues : int * inputAttributes : AFAttributeList * inputValues : AFValues[] -> AFValues override GetValues : context : Object * timeRange : AFTimeRange * numberOfValues : int * inputAttributes : AFAttributeList * inputValues : AFValues[] -> AFValues
Parameters
- context
- Type: SystemObject
The AF SDK context to be used when getting the attribute's values over the specified time range. If the context is not , then the value will be returned relative to the specified AF SDK object. Currently, the following AF SDK objects may be received as a context: AFCase, AFAnalysis, and AFModel. It is up to the data reference to determine how the context should be used when retrieving the attribute's value.
The AF SDK will adjust the context to send only contexts that are specified in the AFDataReference.SupportedContexts property. Specifically, if Case context is passed but not supported, then context will be changed to Model Analysis context. If Model Analysis context is passed but not supported, then context will be changed to Model context. Finally, if Model context is passed but not supported, then context will be changed to no context.
- timeRange
- Type: OSIsoft.AF.TimeAFTimeRange
The time-range to be used when getting the attribute's collection of values. - numberOfValues
- Type: SystemInt32
The number of values desired. The behavior of GetValues varies based on the value of this parameter:- If 0, then all recorded values within the timeRange will be returned with an interpolated value at the start and end time, if possible.
- If the number of values requested is less than zero, then if supported, the Data Reference will return evenly spaced interpolated values across the timeRange, with a value returned at both end points of the time range. For example, specifying -25 over a 24 hour period will produce an hourly value.
- If the number of values requested is greater than zero, the method will behave like the PlotValues method. This method is designed to return a set of values over a time period that will produce the most accurate plot while minimizing the amount of data returned. The number of intervals specifies the number of pixels that need to be represented in the time period. For each interval, the data available is examined and significant values are returned. Each interval can produce up to 5 values if they are unique, the first value in the interval, the last value, the highest value, the lowest value and at most one exceptional point (bad value and/or annotated value). If no data is available in an interval, then no value is generated for that interval. As a result, the method may return more or fewer values than the number of values requested, depending on the distribution of recorded values over the time range. For Data References which use multiple PI Point sources, the list of values returned in each interval may be greater than 5 depending upon the data reference implementation.
- inputAttributes
- Type: OSIsoft.AF.AssetAFAttributeList
The input attributes as previously specified by the data reference in the GetInputs(Object) call. The index of the values will match the index of the corresponding attribute previously returned. These values must be converted to the appropriate UOM required by this data reference. - inputValues
- Type: OSIsoft.AF.AssetAFValues
The input values are supplied to the data reference based on the attributes returned in the GetInputs(Object) call. The index of the values will match the index of the corresponding attribute previously returned. These values must be converted to the appropriate UOM required by this data reference.
Return Value
Type: AFValuesReturns the collection of values for the attribute sorted in increasing time order.