- (YesNo). This validation formula queries the user concerning the TotalAmount field. If the user clicks No, a failure message is posted.
@If(@Prompt([YesNo]; "Is this total within budget?"; @Text(TotalAmount; "C")); @Success; @Failure("Total not within budget"))
- (OkCancelEdit). This button formula queries the user for a server and database, and opens the database. If the user clicks Yes without first entering a value in the edit box, the value returned is an empty string.
server := @Prompt([OkCancelEdit]; "Server"; "Enter the name of a server"; "");
database0 := @Prompt([OkCancelEdit]; "Database"; "Enter the name of a database on " + @If(server = ""; "your workstation"; server); "");
database := @If(@Contains(database0; "."); database0; database0 + ".nsf");
@Command([FileOpenDatabase]; server : database)
- (Password). This field validation formula gets a password from the user and compares it to the Password field in the document.
pass := @Prompt([Password]; "Password"; "What is the password?");
@If(pass = Password; @Success; @Failure("Password incorrect"))
- (OkCancelList). This formula presents the user with a list of databases in a database catalog, and opens the database that the user selects. The first @DbColumn puts a list of the values in column 4 of the Databases by _Replica ID view in the temporary variable titles. The second @DbColumn puts a list of the values in column 2 of the Databases by _Replica ID view in the temporary variable servers. The third @DbColumn puts a list of the values in column 3 of the Databases by _Replica ID view in the temporary variable databases. The temporary variable list combines titles, servers, and databases for presentation to the user in @Prompt. The formula then parses the return value from @Prompt into a server name and database name for inclusion in the FileOpenDatabase @command.
titles := @DbColumn(""; "doc":"catalog.nsf"; "Databases by _Replica ID"; 4);
servers := @DbColumn(""; "doc":"catalog.nsf"; "Databases by _Replica ID"; 2);
databases := @DbColumn(""; "doc":"catalog.nsf"; "Databases by _Replica ID"; 3);
list := titles + " *-* " + servers + " *:* " + databases;
member := @Prompt([OkCancelList]; "Open Database"; "Select a database"; ""; list);
server := @Left(@Right(member; " *-* "); " *:* ");
database := @Right(member; " *:* ");
@Command([FileOpenDatabase]; server:database)
- (OkCancelListMult). This button formula presents the user with a list of department names and sales totals. The user selects any number of elements from the list and the formula calculates a grand total.
departments := @DbColumn(""; "" : "sales.nsf"; "Main View"; 1);
totalSales := @DbColumn(""; "" : "sales.nsf"; "Main View"; 2);
totalsList := @Text(totalSales; "C") + " " + departments;
sumList := @Prompt([OkCancelListMult]; "Total sales by department"; "Select the ones you want to sum"; ""; totalsList);
sum := @Sum(@TextToNumber(sumList)); @Prompt([Ok]; "Sum"; @Text(sum))
- (Custom). This button formula presents the user with the "Databases by Replica ID" view from catalog.nsf on the server named doc. The user selects an element (row) from the list (view) and the formula opens that database with its name in column 3 of that row.
name := @PickList([Custom]; "doc" : "catalog"; "Databases by Replica ID"; "Open database"; "Select a database that is on server Doc"; 3);
@Command([FileOpenDatabase]; "doc" : name)