AFDataReference.UpdateValue Method (AFValue, AFUpdateOption)
- Last UpdatedNov 18, 2025
- 3 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 void UpdateValue( AFValue value, AFUpdateOption updateOption )
Public Overridable Sub UpdateValue ( value As AFValue, updateOption As AFUpdateOption ) Dim instance As AFDataReference Dim value As AFValue Dim updateOption As AFUpdateOption instance.UpdateValue(value, updateOption)
public: virtual void UpdateValue( AFValue^ value, AFUpdateOption updateOption )
abstract UpdateValue : value : AFValue * updateOption : AFUpdateOption -> unit override UpdateValue : value : AFValue * updateOption : AFUpdateOption -> unit
Parameters
- value
- Type: OSIsoft.AF.AssetAFValue
The value to be written or replaced on the target system. - updateOption
- Type: OSIsoft.AF.DataAFUpdateOption
An enumeration value that specifies how duplicate values should be handled.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | The value is . |
| NotSupportedException | The data reference does not support this method. |
Remarks
If the attribute does not have a data reference configured and if it is not a dynamic attribute, then the attribute's value will be updated in the PI AF Server immediately. Updating a value to a PI AF Server Collective requires the primary AF Server to be running and will be replicated to the secondary AF Server through SQL Server replication.
If multiple attributes of this type are written to, consider using the AFListData.UpdateValues method for better performance.
If the attribute has a configured data reference, then the data reference must support the UpdateValue method. This is indicated by having the UpdateValue flag set in the SupportedDataMethods property. The PI Point Data Reference supports UpdateValue for simply configured PI Points.
For the case of attributes which are configuration items, this method (unlike AFAttribute.SetValue) does not require the corresponding AFElement to be checked out or checked in.
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 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. |
| For the case of attributes that do not have a data reference and which are configuration items, if the corresponding AFElement is already checked out by another user (i.e. through AFAttribute.SetValue) when this method is called, then the value(s) to update may be lost when the other user checks in the AFElement. |
| Exceptions thrown by the configured data reference will be propagated. |