# Writing formulas that evaluate to a result

The final statement of the following formulas must evaluate to a result:

- Replication formula -- Must evaluate to True (1) or False (0), and is applied to each document in the database.
- Form formula -- Must evaluate to the name of a form.
- Selection formula -- Must evaluate to True (1) or False (0), and is applied to each document in the view.
- Column formula -- Must evaluate to a value that can be converted to a text string.
- Hide action formula -- Must evaluate to True (1) or False (0).
- Formula pop-up -- Must evaluate to a text string.
- Window title formula -- Must evaluate to a text or numeric value, except that the formula can consist of a single field of any type.
- Section access formula -- Must evaluate to a name or list of names.
- Insert subform formula -- Must evaluate to a text value that is the name of a subform.
- Section title formula -- Must evaluate to a text or numeric value, except that the formula can consist of a single field of any type.
- Hidden paragraph formula -- Must evaluate to True (1) or False (0).
- Default value formula -- Must evaluate to a value suitable for storage in the current field.
- Input translation formula -- Must evaluate to a value suitable for storage in the current field.
- Default validation formula -- Must evaluate to success (1) or failure (0).
- Computed field formula -- Must evaluate to a value suitable for storage in the current field.
- Keyword field formula -- Must evaluate to a value or list of values suitable for storage in the current field.

These formulas may be as simple as a single field, constant, or @function, or may contain multiple statements, use temporary variables, modify fields, and produce side-effects. In all cases, however, their final statement must be a value suitable for the result.

The reserved word SELECT is prepended to the logical statement that terminates a replication or selection formula if SELECT is not explicitly specified. These formulas run against every document in the database (replication formula) or view (selection formula) to determine their inclusion or exclusion in the replication process or the view. The @All function returns the value True, so the formula "SELECT @All" includes all documents.