AFAttributeTemplate.SetValue Method
- 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 void SetValue( Object newValue, UOM specifiedUOM )
Public Sub SetValue ( newValue As Object, specifiedUOM As UOM ) Dim instance As AFAttributeTemplate Dim newValue As Object Dim specifiedUOM As UOM instance.SetValue(newValue, specifiedUOM)
public: void SetValue( Object^ newValue, UOM^ specifiedUOM )
member SetValue : newValue : Object * specifiedUOM : UOM -> unit
Parameters
- newValue
- Type: SystemObject
The new value for the attribute. - specifiedUOM
- Type: OSIsoft.AF.UnitsOfMeasureUOM
The unit of measure of the newValue parameter. If this parameter is , then the DefaultUOM property is used. If this parameter is not and the DefaultUOM property has not been set, then the DefaultUOM property will be set to this value.
Exceptions
| Exception | Condition |
|---|---|
| InvalidCastException | Thrown when the conversion to the specified UOM or configured Type cannot be performed. |
Remarks
The GetValue and SetValue calls of an attribute template are not forwarded to the associated data reference. When an attribute is created from this template, the template's value will be used as the default value. If a data reference is not configured for an attribute created from this template, then the attribute's value will continue to return the template's default value until the attribute's value is specifically set.
A value of any type may be written with SetValue. However, in order for a value to be saved, it must either be a .NET base type, a .NET serializable type, or support the PI SDK's IPIPersist interface. This means it is possible to write values such as arrays, System.Data.DataSet's, PISDK.PIPoint's, and references to other Application Framework objects. All DataReferences are not required to support all .NET types so the value must be compatible with the underlying DataReference.