Controlling the Flow of a Formula

You can use only a couple of methods to control the flow within a formula. Remember that a formula is a lot like a single line of code. You can't pass parameters into or out of a formula. You have no subroutines to which you can pass control. However, you can stop the execution of a formula with @Return() or cause it to continue with @Success . You can also execute a formula sequence with @Do(statement 1; statement 2; ...) . You can combine either or both of these with @If() to provide a flow control of sorts. In the previous document history example, the execution of the formula was stopped using @Return() unless the document was being saved. The code is shown in the following example:

@If(@IsDocBeingSaved ; @Success ; @Return("") ) ;

Sometimes you need to execute two different series of statements depending on a certain condition in the document. To accomplish this, you use @If() combined with @Do() , as in the following example:

@If(cStatus = "Complete"; 
 @Do(@SetField("dComplete"; @Today);
 @SetField("cCompletedBy"; @Name([Abbreviate]; @UserName))) ;
 cStatus = "Pending";
 @Do(@SetField("dAssigned"; @Today));

To provide a semblance of control logic can be quite a bit of work using nested @If() and @Do() statements. Go slowly and test your logic at each step of the way.

Part I. Introduction to Release 6

Whats New in Release 6?

The Release 6 Object Store

The Integrated Development Environment

Part II. Foundations of Application Design

Forms Design

Advanced Form Design

Designing Views

Using Shared Resources in Domino Applications

Using the Page Designer

Creating Outlines

Adding Framesets to Domino Applications

Automating Your Application with Agents

Part III. Programming Domino Applications

Using the Formula Language

Real-World Examples Using the Formula Language

Writing LotusScript for Domino Applications

Real-World LotusScript Examples

Writing JavaScript for Domino Applications

Real-World JavaScript Examples

Writing Java for Domino Applications

Real-World Java Examples

Enhancing Domino Applications for the Web

Part IV. Advanced Design Topics

Accessing Data with XML

Accessing Data with DECS and DCRs

Security and Domino Applications

Creating Workflow Applications

Analyzing Domino Applications

Part V. Appendices

Appendix A. HTML Reference

Appendix B. Domino URL Reference

Lotus Notes and Domino 6 Development
Lotus Notes and Domino 6 Development (2nd Edition)
ISBN: 0672325020
EAN: 2147483647
Year: 2005
Pages: 288 © 2008-2020.
If you may any questions please contact us: