Get started Bring yourself up to speed with our introductory content.

Lotus Notes Formula language general syntax rules

Here are the general syntax rules for Formula language for Lotus Notes.

The following is tip #5 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 general syntax rules

The Formula Language syntax rules are quite simple. All formulas must adhere to the following five rules.

Rule 1:
A semicolon must separate all formulas that contain more than one statement. It's important to understand that multiple statements can reside on a single line, provided that a semicolon delineates each statement. For example, the following are valid multi-statement formulas.

Example 1

DEFAULT status := "New Request"; status

Example 2

DEFAULT status := "New Request";
status

Rule 2:
At least one space must follow all reserved keywords. Otherwise, any number of spaces --from none to many -- may be used to separate operators, punctuation, and values. For example, the following are valid and equivalent statements (with regard to spacing):

output := "Today's date is: " + @Today;
output:="Today's date is: " + @Today;
FIELD output:= "Today's date is: " + @Today;

Rule 3:
Two values, variables, or strings must be separated by at least one operator. For example, the following are valid statements. In the first example, the plus sign is used to sum the two numbers and divide the result by 2. In the second example, the plus sign is used to concatenate two values together. Finally, the third example shows three @Functions separated by the plus operator.

output := (100 + 200)/2;
output := "The sum of the two numbers is: " + total;
output := @Month+@Day+@Year;

Rule 4:
You must use the := assignment operator to assign a value to a variable, whereas the equal sign = is used to compare two values when used in a conditional statement (such as the @IF, @WHILE, or @FOR functions).

myVariable := "This is a valid assignment";  

Rule 5:
All formulas must contain a main expression that either produces a value or performs an action. For example, the following are valid main expressions. The following returns today's date.

@Today

The following checks if the value stored in the result variable is equal to one. If the condition is true, then the formula returns the text string "Yes". Otherwise, the formula is set to a text string "No."

@If ( result = 1; "Yes"; "No")


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 last published in March 2007

Dig Deeper on Lotus Notes 5

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close