AFData.UpdateValue Method (AFValue, AFUpdateOption, AFBufferOption)
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Data
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void UpdateValue( AFValue value, AFUpdateOption option, AFBufferOption bufferOption )
Public Sub UpdateValue ( value As AFValue, option As AFUpdateOption, bufferOption As AFBufferOption ) Dim instance As AFData Dim value As AFValue Dim option As AFUpdateOption Dim bufferOption As AFBufferOption instance.UpdateValue(value, option, bufferOption)
public: void UpdateValue( AFValue^ value, AFUpdateOption option, AFBufferOption bufferOption )
member UpdateValue : value : AFValue * option : AFUpdateOption * bufferOption : AFBufferOption -> unit
Parameters
- value
- Type: OSIsoft.AF.AssetAFValue
The value to be written or replaced on the target system. Proper UOM coercion of Value will be performed in terms of the attribute's DefaultUOM property. If the data reference is a PI Point then proper type coercion of Value will be performed in terms of the PointType property. - option
- Type: OSIsoft.AF.DataAFUpdateOption
An enumeration value that specifies how to treat duplicate values. It can also be used to specify that an existing value should be removed. - bufferOption
- Type: OSIsoft.AF.DataAFBufferOption
An enumeration value that specifies buffering option.
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 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. |
| 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. |