Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFData.UpdateValue Method (AFValue, AFUpdateOption)

AFData.UpdateValue Method (AFValue, AFUpdateOption)

  • Last UpdatedNov 18, 2025
  • 4 minute read
AFData.UpdateValue Method (AFValue, AFUpdateOption)
This method writes, replaces, or removes a value on the target system using the configured data reference.

Namespace:  OSIsoft.AF.Data
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public void UpdateValue(
	AFValue value,
	AFUpdateOption option
)
Public Sub UpdateValue ( 
	value As AFValue,
	option As AFUpdateOption
)

Dim instance As AFData
Dim value As AFValue
Dim option As AFUpdateOption

instance.UpdateValue(value, option)
public:
void UpdateValue(
	AFValue^ value, 
	AFUpdateOption option
)
member UpdateValue : 
        value : AFValue * 
        option : AFUpdateOption -> 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.

Exceptions

ExceptionCondition
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.

Note Notes to Callers
This method, property, or class is not available in the legacy .NET 3.5 version of the SDK.

Security note Security Note
You must have WriteData security rights to write a data value.

Important note Important
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.

Caution note Caution
Exceptions thrown by the configured data reference will be propagated.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in