Property Constraints and Validation

Data Standard leverages the property constraints configured in property definitions.

Constraints

You can add custom properties, and modify or override existing property constraints from Vault.

To modify constraints, use for example $Prop["Title"].IsObligatory = $true.

To add properties, use $Prop["CustomProperty"].Value = "somevalue". For Inventor and AutoCAD, the new property will be saved as custom property when you save the document.

  1. In the Default.ps1 file, add the new required property, for example: $Prop["SomeProperty"].IsObligatory = $true
  2. Open a Data Standard client in Vault, Inventor or AutoCAD.
  3. Display the Data Standard dialog.
  4. The edited field with the required property is highlighted in red border indicating that the input is necessary.

Validation

You can add custom validation to properties. This allows to validate against custom constraints defined in particular functions.

To add a custom validation, use $Prop["CustomProperty"].CustomValidation = { MyValidation }. The function “MyValidation” has to return $true or $false, based on your custom constraints.

Validation - Examples

CAD: Review the powerShell script .\CAD\addins\FileNameValidation.ps1 installed with Vault Data Standard Inventor / AutoCAD.

Vault: Review sample code in the configuration - Example–Add Custom Validation for FolderNames.

Note: You can still use the legacy behavior for CAD to configure additions/overrides in the property section of CFG files. For Vault, the new custom validation functions are another customization layer and can be used in addition to the existing function “Validate”. Click here for additional constraints on the $Prop object.