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

AF SDK Reference

AFAttributeTemplate.SetValue Method

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFAttributeTemplate.SetValue Method
Sets the default value for an attribute template in the specified unit of measure. This value will be used as the default value for the attributes created from this template.

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

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

Version Information

AFSDK


See Also

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