PIPoint.ReplaceValuesAsync Method (AFTimeRange, IList(AFValue), CancellationToken)
- 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.
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public Task<AFErrors<AFValue>> ReplaceValuesAsync( AFTimeRange timeRange, IList<AFValue> values, CancellationToken cancellationToken = default )
Public Function ReplaceValuesAsync ( timeRange As AFTimeRange, values As IList(Of AFValue), Optional cancellationToken As CancellationToken = Nothing ) As Task(Of AFErrors(Of AFValue)) Dim instance As PIPoint Dim timeRange As AFTimeRange Dim values As IList(Of AFValue) Dim cancellationToken As CancellationToken Dim returnValue As Task(Of AFErrors(Of AFValue)) returnValue = instance.ReplaceValuesAsync(timeRange, values, cancellationToken)
public: Task<AFErrors<AFValue^>^>^ ReplaceValuesAsync( AFTimeRange timeRange, IList<AFValue^>^ values, CancellationToken cancellationToken = CancellationToken() )
member ReplaceValuesAsync : timeRange : AFTimeRange * values : IList<AFValue> * ?cancellationToken : CancellationToken (* Defaults: let _cancellationToken = defaultArg cancellationToken new CancellationToken() *) -> Task<AFErrors<AFValue>>
Parameters
- timeRange
- Type: OSIsoft.AF.TimeAFTimeRange
The bounding time range for replacement of the existing values. - values
- Type: System.Collections.GenericIListAFValue
The list of replacement values with an associated PIPoint for each value. If an empty list then existing data within the specified AFTimeRange will be deleted. The time stamp of AFValue in values must be within the specified AFTimeRange. - cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
A cancellation token used to abort processing before completion. Passing the default CancellationToken.None will run to completion or until the PIConnectionInfo.OperationTimeOut period elapses.
Return Value
Type: TaskAFErrorsAFValueReturns a task whose result is if there are no errors. Otherwise the result is an AFErrorsTKey instance containing error information.
Exceptions
| Exception | Condition |
|---|---|
| AggregateException | Asynchronous methods throw AggregateException on failure which will contain one or more exceptions containing the failure. |
Remarks
This method requires PI Data Archive 2016 or later that supports DeleteRange feature. This is indicated by Supports(PIServerFeature) check returning for the case of DeleteRange.
If not specified in AFSDK.config, the AFBufferOption is defaulted to BufferIfPossible. The default buffering option for the current AF SDK client instance can be modified via the static property AFData.BufferOption.
| This call might use a background task to complete some of its work. See the Threading Overview for some matters to consider when execution transitions to another thread. |