# Expressions for field validation

In a field profile's Validation settings, use the Expression box to type an expression for validation of a numerical field or fields (including barcode fields). For example, you could use this to confirm that the sales tax on an invoice is the correct percentage of the total sum. This is part of validating field values.

The table below shows the characters that are valid in expressions used to validate fields.

 Character Meaning Example Arithmetic operators + Plus =FieldA+FieldB - Minus =FieldA-FieldB : Sum of fields from/to FieldA*10 / Divide =FieldA/2 (If both operands are integers, the result is an integer.) % Remainder =FieldA%100 (returns the remainder of FieldA / 100) Conditional operator ? Does the field exist? =?FieldB (returns 1 if the field exists, otherwise 0) Relational operators = Equal to =100 > Greater than >FieldC < Less than = Greater than or equal to FieldA>=FieldB <= Less than or equal to FieldA<=FieldB+FieldC Logical operator ; And (between two expressions) FieldA=FieldB+FieldC; FieldA=FieldD Other characters ( ) Parentheses (FieldA+FieldB)*FieldC
• Spaces around operators are allowed. However, they limit the space available for typing your expression.
• Keep in mind that field names are case-sensitive.
• Nested parentheses are not allowed.

There are two types of expressions. For more information, click the one that applies to your situation:

Type 1 validates the current field in relation to other fields.

Type 2 validates any numerical field in the invoice profile.

Note If the current field is non-numeric, the expression must be type 2 and validate another field, because non-numeric fields cannot be validated by an expression. Furthermore, when you use a semicolon as the AND operator, the expression must always be type 2.