Rules for Creating Formulas |
Working with Formulas > Rules for Creating Formulas
This page offers general rules for creating formulas and ways to determine whether a formula is valid:
Rules for Creating Formulas
Expressions must follow a set of rules for the software to interpret them. To create a formula with correct syntax, the following rules apply:
Valid and Invalid Expressions
When you create formula, it needs to be valid in order for the software to accept it. A valid formula is one that is syntactically correct, meaning that the identifiers, functions, operators and values in the expression are arranged as discussed in the above rules.
The formula builder has a built-in tool that lets you know the validity of any given formula by showing either a green check mark for a valid formula or a red "X" for an invalid one. This formula checker automatically updates as you type.
NOTE: The formula validation indicator is disabled for external data tables so that native database expressions can be entered in the formula builder and run against the external database.
Handling Folder, Table and Field Names with Spaces
In many situations, folder names, table names and field names do not contain spaces in them, such as "myfield" or "my_table" or "my_data_folder". These can be referenced in a formula or a query using the name or the name with brackets around it. For example the following two expression are both valid:
Field1 * Field2 [Field1] * [Field2]
At other times folders, tables or field names have spaces in them, such as "my field" or "my data folder". In order to reference these in a formula or query, the full name must be contained within brackets. For example, the following two expressions are valid:
[Field 1] * [Field 2] Field1 * [Field 2]
When field names and table names are used together, the same rules apply, but the table name and field name portion work independently so that brackets are only required for the name that includes spaces. Here are some valid examples:
Table1.Field1 * Table2.Field2 Table1.[Field1]*[Table2].Field2 [Table1].[Field1]*Table2.[Field2] Table1.[Field 1] * Table2.[Field 2] [Table 1].[Field 1]*[Table 2].Field2
|