AFDataReference.ReplaceValues Method (AFTimeRange, AFValues, AFBufferOption)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
This method removes existing data within the specified AFTimeRange and
inserts the specified values on the target system using the configured data reference.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public virtual AFErrors<AFValue> ReplaceValues( AFTimeRange timeRange, AFValues values, AFBufferOption bufferOption )
Public Overridable Function ReplaceValues ( timeRange As AFTimeRange, values As AFValues, bufferOption As AFBufferOption ) As AFErrors(Of AFValue) Dim instance As AFDataReference Dim timeRange As AFTimeRange Dim values As AFValues Dim bufferOption As AFBufferOption Dim returnValue As AFErrors(Of AFValue) returnValue = instance.ReplaceValues(timeRange, values, bufferOption)
public: virtual AFErrors<AFValue^>^ ReplaceValues( AFTimeRange timeRange, AFValues^ values, AFBufferOption bufferOption )
abstract ReplaceValues : timeRange : AFTimeRange * values : AFValues * bufferOption : AFBufferOption -> AFErrors<AFValue> override ReplaceValues : timeRange : AFTimeRange * values : AFValues * bufferOption : AFBufferOption -> AFErrors<AFValue>
Parameters
- timeRange
- Type: OSIsoft.AF.TimeAFTimeRange
The bounding time range for replacement of the existing values. - values
- Type: OSIsoft.AF.AssetAFValues
The replacement values to be written on the target system. If an empty AFValues then existing data within the specified AFTimeRange will be deleted. The timestamp of AFValue in values must be within the specified AFTimeRange. - bufferOption
- Type: OSIsoft.AF.DataAFBufferOption
An enumeration value that specifies buffering option.
Return Value
Type: AFErrorsAFValueIf there are no errors, then is returned. Otherwise an AFErrorsTKey instance containing error information is returned.
Exceptions
| Exception | Condition |
|---|---|
| InvalidOperationException | The Attribute does not have a data reference configured. |
| NotSupportedException | The data reference does not support this method. |
Remarks
This method requires that the attributes being written, if configured with a data reference, must support the ReplaceValues method. This is indicated by having the ReplaceRange flag set in the SupportedDataMethods property. The PI Point Data Reference supports ReplaceValues for simply configured PI Points.
If AFBufferOption is set to Buffer, this method requires that the attribute has a configured data reference which supports buffering. This is indicated by having the Buffering flag set in the SupportedDataMethods property. The PI Point Data Reference supports buffering.
| This method, property, or class is not available in the legacy .NET 3.5 version of the SDK. |
| You must have WriteData security rights to write a data value. |
| This method is not supported for attributes that do not have a data reference. |