Tutorial

Lotus Notes Formula language keywords

The following is tip #3 from "A Formula language for Lotus Notes introduction -- 7 tips in 7 minutes," excerpted from Chapter 5 of the book Lotus Notes Developer's Toolbox, published by IBM Publishing.

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.


A Formula language for Lotus Notes introduction

 Home: Introduction
 Tip 1: What is Lotus Formula Language?
 Tip 2: Working with variables in Formula language for Lotus Notes
 Tip 3: Lotus Notes Formula language keywords
 Tip 4: Working with operators in Formula language for Lotus Notes
 Tip 5: Lotus Notes Formula language general syntax rules
 Tip 6: What are Lotus Notes Formula language functions and commands?
 Tip 7: Working with text strings in Formula language for Lotus Notes

An Introduction to Formula Language This chapter excerpt from Lotus Notes Developer's Toolbox, by Mark Elliott, is printed with permission from IBM Publishing, Copyright 2006.

Click here for the chapter download or purchase the book here.

This was first published in March 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: