We all strive for good data entry in any ERP system. The fact that we make critical business decisions off this data means we need clean, reliable data. Input validation helps to keep your data clean as it is getting entered into the system versus having to waste time cleaning it manually. Acumatica can help to improve the quality of data as it is entered into the system.
Here’s a tip on how to ensure good data entry in Acumatica
First, there is no choice for a number control type when setting up a custom attributes in Acumatica. By default, a user can type any character (letter or number), even when we only want numbers in that field.
To validate that only numbers are entered into a text field, you need to set up a Regular Expression in the Reg. Exp. Field.
Regular Expressions
Regular expressions are a generalized way to match patterns with sequences of characters. Here are two examples to meet our number requirement.
Regular Expression to validate decimal numbers | ^(\d*\.)?\d+$ |
Regular Expression to validate integer numbers | ^[0-9]*$ |
The first one will ensure that the user enters a valid decimal number for a Weight field.
If the user enters in a character that’s not a number, Acumatica will display an error message when they move out of the field.
All these examples would be valid entries in this field:
- 1
- 23425
- 234
- .6454
- 45
Note: Because the control type is text, the number will be stored in the database as a string, so if you are going to use the value in formulas, you will need to use a conversion function (i.e. CDec).
Other Validation Rules
If you need other validation rules, you can find a lot of Regular Expressions on Google. There are plenty of sites that provide examples, such as Zip Codes, Phone Numbers, and more.
Here’s one I find helpful. It checks for valid web site URLs:
^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$
For example, this entry is valid: https://www.google.com, but this, htt://www.google.com will be rejected.
Don’t miss out on other Acumatica tips and tricks. Subscribe to our blog.