Formula language
Encyclopedia
The Formula language is a scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

 used by Lotus Notes
Lotus Notes
Lotus Notes is the client of a collaborative platform originally created by Lotus Development Corp. in 1989. In 1995 Lotus was acquired by IBM and became known as the Lotus Development division of IBM and is now part of the IBM Software Group...

.

It is often referred to as @Formula language because many language elements start with the @-character. Here is an example of a selection formula:


SELECT @NoteId = "NT0050D26"


It was created by Ray Ozzie
Ray Ozzie
Raymond "Ray" Ozzie is an American software industry entrepreneur who held the positions of Chief Technical Officer and Chief Software Architect at Microsoft between 2005 and 2010...

 during the early development of Lotus Notes. He borrowed the compiler and decompiler from the Lotus 1-2-3
Lotus 1-2-3
Lotus 1-2-3 is a spreadsheet program from Lotus Software . It was the IBM PC's first "killer application"; its huge popularity in the mid-1980s contributed significantly to the success of the IBM PC in the corporate environment.-Beginnings:...

 spreadsheet, but unlike the spreadsheet language Formula Language was designed primarily for string and list processing, not numerical processing. It was originally a Functional programming
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 language with unique text list-handling features inspired by Ray Ozzie's prior use of Icon and Lisp.

The Formula language engine was rewritten from scratch by Damien Katz for Notes and Domino 6. Many new features were added to the language, such as looping and dynamic execution, and performance was improved dramatically.

The Formula language has two parts:
  • @Functions for calculations and simple logic
  • @Commands for performing actions in the user interface


@Functions can be used in several places throughout Lotus Notes. The most important uses are:
  • to select documents to show to the user in a view (a kind of index) or to select documents for further processing. In this case, the formula will evaluate to a 'true' (selected) or 'false' value (not selected) for each document.
  • to provide default values for fields, to transform the data entered by the user (like stripping off redundant spaces) and to validate this data.
  • to get a list of values from a Notes database or even from a relational database (using ODBC). This may be used to provide a user with a list of values to choose from.
  • to process a set of documents. The formula is placed in an agent, a program or macro that can be started by a user or by the Notes server according to a schedule. When the agent is triggered, the formula executes for each selected document (this a very limited form of a loop). This is an efficient way of changing lots of documents, if the logic is not too complicated. In case of complicated changes, LotusScript
    LotusScript
    LotusScript is a dialect of the BASIC programming language used by Lotus Notes and other IBM Lotus Software products.LotusScript is very similar to Visual Basic. Code can often be copied without modification from one to the other, and programmers familiar with one can easily understand the syntax...

    is used.


@Commands are like menu commands: they perform actions in the Lotus Notes client. Examples of actions are:
  • opening a Notes database
  • creating an e-mail
  • putting the cursor in a specific data-entry field
  • closing a window
  • starting an agent

@Commands are primarily used in formulas that are triggered by user action, such as in button formulas. It is possible to combine them with @Functions, for example by making execution of an @command conditional on a field value.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK