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

AF SDK Reference

AFAttributeTrait.ValidateTrait Method

  • Last UpdatedNov 18, 2025
  • 2 minute read
AFAttributeTrait.ValidateTrait Method
Helper function to validate if an AFAttributeTrait is valid for an attribute.

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

Syntax

public static bool ValidateTrait(
	AFAttributeTrait trait,
	IAFAttribute attribute,
	out string errMsg
)
Public Shared Function ValidateTrait ( 
	trait As AFAttributeTrait,
	attribute As IAFAttribute,
	<OutAttribute> ByRef errMsg As String
) As Boolean

Dim trait As AFAttributeTrait
Dim attribute As IAFAttribute
Dim errMsg As String
Dim returnValue As Boolean

returnValue = AFAttributeTrait.ValidateTrait(trait, 
	attribute, errMsg)
public:
static bool ValidateTrait(
	AFAttributeTrait^ trait, 
	IAFAttribute^ attribute, 
	[OutAttribute] String^% errMsg
)
static member ValidateTrait : 
        trait : AFAttributeTrait * 
        attribute : IAFAttribute * 
        errMsg : string byref -> bool 

Parameters

trait
Type: OSIsoft.AF.AssetAFAttributeTrait
The AFAttributeTrait to be validated.
attribute
Type: OSIsoft.AF.AssetIAFAttribute
The AFAttributeTemplate or AFAttribute being checked if the specified trait is valid.
errMsg
Type: SystemString
If the trait is not valid for the attribute, this parameter contains an error message which can be displayed to the user explaining the reason the trait was invalid.

Return Value

Type: Boolean
Returns if the trait is valid. Otherwise is returned and the errMsg parameter is set.

Remarks

This method will validate that the AFAttributeTrait is valid to be set on the specified attribute using the defined behavior rules for the trait. For example, if the trait's RequireNumeric is set and the attribute's type and current value cannot be converted to a numeric value, then this method will return and the errMsg parameter will contain the error message.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5

See Also

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