Grooper 23.00.0020 is available as of 5-15-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 21.00.0073 is available as of 5-19-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.

Validation Script

Hi, I would like to enhance my data validation for fields. One way to do this would be to use Regular Expressions in the validation. One simple example would be to validate using a regular expression. This is just a sample the actual expression will more than likely have more complexity.

The Regex class is found in the .net library "System.Text.RegularExpression".

How do I include a reference to this library, so I can use it for validation?

Also it may make sense to encapsulate some of the more complex checks in a function that I can re-use in multiple fields.
Where do I write this function and how do I reference it in the individual fields validation scripts?

Example of a function that looks for how many 'unusual' characters are in a field value (simplified) and declares it invalid if there are more than three.

Public Function TestValidationUnusualCharacters(input as String)
  Return input.ToCharArray().Count(function(c) {"|","%","^"}.Contains(c)) <= 3
End Function


  • GrooperGuruGrooperGuru Posts: 476 admin
    You are getting into complexity that the expressions are not equipped to handle. But there is good news. You can add a Script to the Data Model itself. In this script you can fire any kind of validation logic you want. To use this interface you'll have to have visual studio and the Microsoft VSTA components installed on your machine. This will allow you to write and edit code from visual studio. When you debug from Visual Studio, it will launch a new instance of Design Studio that takes advantage of your code. You can navigate sample batches to see the results. When finished, you close visual studio. You'll be returned to Grooper where you can save changes and compile your code. Restart Design Studio, and you'll be all set.
    Matt Harrison
    Product Manager
    [email protected]
Sign In or Register to comment.