Using calculation fields, it is possible to check if the number that is entered in a numerical field corresponds to a certain format. For example, you can check if a number contains 3 digits or if it contains 2 decimals.

### Format 000

This template will check how many digits a number contains:

'{number_variable}'.length

Set up a data validation in case the number exceeds or less than a necessary amount of the digits.

### Format 00.0

This template will check for the format 00.0 precisely, thus 11.1 will be valid and 1.11 will be invalid:

if ((/^\d{2}(\.\d{1})$/).test('{number_field}')) { "The number format (00.0) is correct!" } else { "The number does not correspond 00.0. Please enter the number in the correct format 00.0." }

### Format 0.000

This template will check for the format 0.000 precisely, thus 1.123 will be valid and 12.1234 will be invalid:

if ((/^\d{1}(\.\d{3})$/).test('{number_field}')) { "The number format is correct!" } else { "The number format is incorrect. Please enter the correct number." }

### Regular expressions

These templates use so called 'regular expressions' and you can create your own template by modifying this line:

(/^\d{2}(\.\d{1})$/)

You would need to adjust the pattern that marked bold leaving the backlash and the brackets. There are tools which can help you develop your own regular expression patterns:

## Castor Support Team