FIELD (Formula Language)
A reserved word that is necessary when you are assigning values to fields that are stored in a document (as opposed to temporary fields). You can use FIELD to change the contents of an existing field or to create new fields.
You cannot use the FIELD reserved word within an @function. Use @SetField instead.
Syntax
FIELD fieldName := value ;
In some cases, action formulas that don't evaluate to a result (for example, a button formula) return a "No Main or Selection expression in formula" error message. You can supply a value such as an empty string (""), or you could provide an expression at the end of the formula, as shown:
SELECT @All
Usage
This reserved word is most useful in agent, button, hotspot, and action formulas. It does not work in column, selection, hide-when, window title, or form formulas.
Examples
- There is a field named Company on a form. When users compose documents
with this form, they enter the name of the company in this field.
You can write the following filter, which adds "Inc." to the contents
of the Company field:
FIELD Company := Company + ", Inc.";
- Alternatively, you can create a new field called CompanyName in
the form to hold the name of the company plus "Inc.", by assigning
it the following formula:
FIELD CompanyName := Company + ", Inc.";
- To delete the field CompanyName from an existing set of documents,
you can use the following formula:
FIELD CompanyName := @DeleteField;
- To assign a value to a field and use it in an @function:
FIELD fullname := @If(fullname = "";firstname + " " + lastname;fullname)