New in IBM Lotus Notes 6 is the ability to access tables via the Notes Formula language. The new @GetFocusTable function returns the table name, row number, or column number for a table that is in focus (i.e., that contains the cursor). To see this function in action, first assume you have a table on a form (figure 1).
In the "OnHelp" event for the form, add the following Formula language code:
rownumber := @GetFocusTable([CellRow]);
@If(rownumber = "0"; @Prompt([Ok]; "There
is no table in the document"; "Your
cursor is not located in a table");
@Do(
columnnumber := @GetFocusTable(
[CellColumn]);
tablename := @GetFocusTable([TableName]);
tablenamedisplay := @If(tablename0 = "";
"Table has no name"; tablename);
@Prompt([Ok]; "Table";
"Your cursor is located in table: " +
tablename + ". Your cursor is located
in row number: " + rownumber + ", column
number: " + columnnumber)))
When the user has the cursor in the table and presses the F1 key, a dialog appears that shows the table name, row number, and column number of the table (figure 2).
The @GetFocusTable formula works in toolbar buttons and field formulas when the document is in edit mode. It works only in a document in read mode if text or an object is selected in a table. This function doesn't work in Domino Web applications.
 |
| Figure 1: A simple table -- Shows how the new Formula Language constructs to manipulate tables. |
 |
| Figure 2: Prompt box -- The result of executing the @GetFocusTable code. |
This tip comes from Christopher Pepin's "Notes 6 Table Enhancements" in LOTUS ADVISOR MAGAZINE. The article provides an in-depth look at the new table features in Notes 6 and shows you how to use them to access and share data more efficiently. Subscribers can read the full article online at http://Advisor.com/doc/14158.