Where to use scripts and formulas
Before you write code, make sure that a simple action won't do the task. You can design some elements with simple actions in forms or views that do not require programming.
Where you have a choice among programming interfaces, consider these guidelines:
- Formulas are expressions that have program-like attributes. For
example, you can assign values to variables and use a limited control
logic. The formula language interface to Domino Designer is through
calls to @functions and @commands.
In general, formulas are best used for working within the object that the user is currently processing, for example, to return a default value to a field or determine selection criteria for a view. Additionally, formulas provide better performance in some situations and may be more convenient for simple applications. You can also execute looping logic using functions such as @For, @While, and @DoWhiler.
Note: Looping is new with Release 6. - JavaScript is a cross-platform, object-oriented scripting language.
Header scripts may be written in the Programmer's pane by selecting
JS Header from the Objects tab and typing your script in the Script
Area. Scripts may also be attached to specific events such as onClick,
or to objects such as buttons. JavaScript may not be written in an
agent. Domino Designer oversees the compilation and loading of user
scripts, but does not store JavaScript in compiled form. In LotusScript
Web agents, you can use Print statements to output HTML to the browser,
including script tags. For example, Print"<script>function changeLocation(){...}</script>."
JavaScript is best used for Web applications, or when a single application will be used in both the Notes and Web environments. Version 1.4 of the JavaScript language is supported.
- LotusScript is a full object-oriented programming language. Its
interface to Domino is through predefined classes. Domino oversees
the compilation and loading of user code, and automatically includes
the Domino class definitions.
LotusScript is best used where the programming logic is not simple. It excels in accessing stored databases (back-end) and provides some capabilities that formulas do not, such as the ability to manipulate a database access control list (ACL). LotusScript is limited in its UI (front-end) capabilities.
- Java is a full object-oriented programming language. Its interface
to Domino is through predefined classes. It is comparable to LotusScript
in agents but cannot be attached to events in the Domino UI. Domino
oversees the compilation and loading of user code for agents; the
code can be written natively or imported.
Java can be used in agents. Java applications and applets, written and compiled outside of Domino, can access Domino through the class interface.