Grooper 21.00.0082 is available as of 12-12-2023! Check the Downloads Discussion for the release notes and to get the latest version.
Grooper 23.00.0044 is available as of 06-20-2024! Check the Downloads Discussion for the release notes and to get the latest version.
Grooper 23.1.0024 is available as of 09-03-2024! Check the Downloads Discussion for the release notes and to get the latest version.
Validation Script
hjanum
Posts: 113 ✭✭
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".
Src: https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex?view=netframework-4.7.2
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
The Regex class is found in the .net library "System.Text.RegularExpression".
Src: https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex?view=netframework-4.7.2
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
0
Comments
Product Manager
mharrison@bisok.com