Formula Language Keywords

As with any programming language, Formula Language includes a number of reserved keywords that have special meanings. These keywords are used to perform special functions and cannot be used as variables. For example, the following table describes the current list of Formula Language reserved keywords.

Keyword

Meaning

DEFAULT

Used to define the initial or default value for a field. For example, let's say you have a field called Status. Using the following formula, the field will be set to a value of "New Request" when the document is created. This field will continue to hold this value until either the user or the Notes application changes the value. After the stored value is changed and the document is saved, the new value will be stored in the field.

DEFAULT Status := "New Request"; Status  

ENVIRONMENT

Used to assign a value to an environment setting in the user's NOTES.INI file. For example, let's say you have a database to request helpdesk support. Using the environment keyword, you could capture and store the employee's serial number in the NOTES.INI file the first time an employee submits a service request. As new requests are submitted, the database could query for the existence of the field and automatically fill in the EmpNum field with the employee's serial number. If the environment variable does not already exist in the INI file, Notes will create the variable and assign it a value. Otherwise, if the variable already exists, Notes will assign the new value.

ENVIRONMENT EmpNum := "123456";  

Note: The @Environment function can also be used to retrieve (or set) an environment variable setting.

FIELD

Used to assign a value to a field on a document or form. If the field exists, the new value will be assigned. If the field does not exist, the field will be created and assigned the value. For example, the following assigns the current date to a field called theDate.

FIELD theDate := @Today;  

REM

Used to add comments to a formula. Comments must be enclosed in quotes or braces and terminated with a semicolon (if part of a multi-line formula). For example:

REM "This is a comment."; REM {This is a comment};  

SELECT

Used to determine the selection criteria for a view, agent, or replication formula. All documents that match the selection formula will be included in the view, agent, or replication formula. For example, let's say you have a Notes database with multiple forms. To create a view that only displays one of the forms, you would define a selection formula similar to the following:

SELECT form = "ServiceRequest";  

By default, reserved words are always the first word in a statement. Reserved words may be entered in lower, upper, or mixed case. However, Designer will automatically convert lower or mixed case words to uppercase when the formula is saved.

Категории