AFAttributeTrait.ValidateTrait Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
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: BooleanReturns 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.