Defining field validation

You can select validation options to ensure that data is entered into a field correctly. When validation options are selected, FileMaker Pro displays a message if you enter data incorrectly. For example, you can set an option to require that users enter a value in a field.

To choose field validation options:

  1. Choose File menu > Manage > Database.

  2. Click the Fields tab.

  3. If your database contains more than one table, select the appropriate table from the Table list.

  4. Select an existing field or define a new one.

  5. Click Options (or double-click the field name).

  6. In the Options for Field dialog box, click the Validation tab.

  7. For Validate data in this field, choose Always for ongoing field validation, or Only during data entry to limit validation to instances when data is being entered. Select Allow user to override during data entry if you want the user to override validation warnings.

  8. To require that the entered value

    Select

    Contains only numbers

    Strict data type, then choose Numeric Only from the list

    Is a date containing numeric values for the month and day, and four digits for the year (for example, 5/12/2019)

    Strict data type, then choose 4-Digit Year Date from the list

    Is a time containing numeric values for hours and minutes between 00:00 and 23:59 (seconds are not evaluated for this data type validation)

    Strict data type, then choose Time of Day from the list

    Is not blank

    Not empty

    Does not duplicate a value found in this field in other records

    Unique value

    Matches another value in the same field in any other record

    Existing value

    Matches a value in a specified value list

    Member of value list, then choose a value list. (Choose Manage Value Lists to create a list.)

    Is within a specific range of letters (alphabetically), numbers, dates, or times

    In range, then type the beginning and ending values

    Matches the result of a calculation

    Validated by calculation (or click Specify), then enter:

    Self = <match>

    where <match> is an expression that the entered value must match. See Defining calculation fields for information about the dialog box.

    Select or clear Validate only if field has been modified, then click OK.

    Does not exceed specified number of characters

    Maximum number of characters, then type the maximum number of characters allowed

    Does not exceed a specified file size (for container field)

    Maximum number of kilobytes, then enter the number of kilobytes. This setting limits the size of a file that's embedded in a container field or stored externally. This setting has no effect on files that are stored by reference in a container field.

  9. To display a custom message if validation fails, select Display custom message if validation fails (or click Specify), then enter a calculation.

    See Specify Calculation dialog box.

  10. Click OK.

Notes 

  • If the Validation by calculation option is used, the field value is successfully validated if the calculation evaluates to a Boolean value of true. In calculations that compare one value to another, the values must exactly match to evaluate to true. By default, FileMaker Pro calculates to 16 digits of precision to the right of the decimal. If you are validating fields by calculation that return fractional results, you can use the Round function to limit calculation results to an expected number of digits.

  • You can also specify the auto-complete option for text fields to help ensure accuracy for data entry. See Setting up a field to auto-complete during data entry.

  • The following validation options are triggered when you exit the field:

    • Strict data type

    • Unique value

    • Existing value

    • Member of value list

    • In range

    • Maximum number of characters

    The following validation options are not triggered until you commit the entire record:

    • Not empty

    • Validated by calculation

  • Validation on a global field triggers when you exit the field, not when you commit the entire record.

  • In a repeating field, FileMaker Pro validates each repetition individually.

  • If the Display custom message if validation fails option is used:

    • FileMaker clients earlier than version 21.1.1 can't display or set a custom message from a calculation (they can only display and set a static custom message). However, if a custom message had already been set by an earlier version of FileMaker Pro, earlier clients will still display it even after you add a calculated custom message that newer clients will display. If a custom message hadn't been set by an earlier version of FileMaker Pro, and you then add a calculated custom message, earlier clients will display a default custom message, which you can edit with an earlier version of FileMaker Pro.

    • Though you can enter a message or a calculation in the box below this option, the box supports only up to 255 characters. To enter more, click Specify.