Subject: Push data into existing documents
Here are some guidelines for creating view actions
To build an action, you can use any of the following:
Simple actions that you select from a list
Formulas
LotusScript
JavaScript
Common JavaScript
When to use actions
Because actions are available in a view or document, use them for any general-purpose task related to a group of documents.
When the automated task is relevant only to a subset of documents.
When users need to see all the available choices in a row at the top of a document.
When the automated task isn’t limited to a particular section of a form.
If formulas are complex and you don’t want to save the formula with each document.
Examples of actions
View actions – Let users create, print, delete, or categorize documents.
Form actions – Process an approval; mail a document; or give Web users, who don’t have access to Notes menus, a way to click to edit, save, or close documents.
General Syntax Rules:
A formula must follow these general syntax rules.
Statement separators
Separate multiple statements with semicolons.
FIELD RegionalManager := AreaManager;
FIELD AreaManager := @DeleteField
Spaces
You can place any number of spaces, including none, between operators, punctuation, and values. However, keywords must be delineated by at least one space, and spaces within text constants are significant.
For example, the following statements are equivalent.
LastName + ", " + FirstName;
LastName+", "+FirstName
In the following statement, at least one space must follow the reserved word SELECT.
SELECT @All
Case
Case is not significant except within text constants. By convention, keywords such as FIELD are uppercase, and @function and @command names such as ProperCase are mixed uppercase and lowercase. You need not follow these conventions when typing, but Domino changes the case to conform to the conventions when saving a formula.
Operators and values
Two values must be separated by at least one operator.
Working With @Functions
All @functions evaluate to a value and can be placed in a formula anywhere a value of that type can be placed. When the formula executes, the value of the formula takes the place of the formula. Some formulas also have side-effects, that is, they cause actions to occur. For example, @Prompt causes a message box to appear.
Most @functions can be used in formulas for any Notes object, but some @functions are restricted in their applicability. The following table lists the @functions that are restricted and lists the Notes objects in which they can be used effectively. In addition, for an @function to return information on the current database, view, document, or field, these objects must be current.
Working With @Commands:
@Commands are special @functions that perform immediate actions in the user interface. Most @commands mimic menu commands. For example, the following formula, if executed from a button, puts the current document in Edit mode and moves the insertion point down twice:
@Command([EditDocument]; “1”);
@Command([EditDown]; “2”)
The syntax for an @command is one of the following:
@Command([command-name]; arg1; arg2; … argn)
@PostedCommand([command-name]; arg1; arg2; … argn)
The name of the @function is @Command or @PostedCommand. The first argument is the name of the @command enclosed in brackets. The remaining arguments are the arguments to the @command.
See @Commands for a list of the available commands.
You can use @commands in formulas for toolbar buttons, agents that do not specify target documents, events, button hotspots, and action hotspots. You cannot use @commands in a formula that does not interact with the user. These include replication, form, selection, column, hide action, window title, section title, section access, insert subform, hidden paragraph, default value, input translation, input validation, computed value, and keyword field formulas, and agents other than those that specify no target documents.
You cannot use most @commands in Web applications, since @commands are based on the Notes workstation user interface. About 30 @commands are supported but some behave differently. See “Programming Domino for Web Applications,” “Formula language.”
You cannot use @commands with LotusScript.
@Command functions execute in sequence with other @functions, with some exceptions. For example, the following formula executes the @command first:
@Command([EditDocument]; “1”);
@Prompt([OK]; “Edit mode”; “The document is now in Edit mode.”)
@PostedCommand functions execute in sequence with each other after all other @functions execute. This emulates the behavior of @Command in Notes R3. For example, the following formula executes the @command last:
@PostedCommand([EditDocument]; “1”);
@Prompt([OK]; “Edit mode”; “The document will go into Edit mode.”)
You can check and respond to the return value of @Command (but not @PostedCommand). The return value is @True if the @command succeeds and @False if it fails. The following toolbar button formula returns if the FileOpenDatabase @command fails.
@If(@Command([FileOpenDatabase]; “NEWSUBJ”); “”; @Return(“”));
@Command([Compose]; “”; “Main Topic”);
@Command([EditGotoField]; “Subject”);
@Command([EditInsertText]; “New subject”);
@Command([EditGotoField]; “Body”)
Try it - its fun!