PROGRAMMING OVERVIEW AND USER INTERFACE


Examples: Agents
1. This LotusScript code writes a value to the Category field based on the value of the TotalSales field of each document in the database. Compare with Examples 2 and 3, which use Java and formula solutions. The script example requires more lines of code than the formula solution but includes the algorithm for finding the documents being processed.
2. This Java agent writes a value to the Category field based on the value of the TotalSales field of each document in the database. Compare with Examples 1 and 3, which use LotusScript and formula solutions. As with LotusScript, the Java code includes the algorithm for finding the documents being processed.
3. This formula writes a value to the Category field based on the value of the TotalSales field of each document in the database, assuming that all documents are selected for processing. Compare with Examples 1 and 2, which use LotusScript and Java solutions. The formula executes once on each document selected by combining outside criteria with the SELECT statement. Data declarations are implicit and formula syntax is cryptic making for compact source code.
4. This formula writes a value to the Category of selected documents based on the value of the TotalSales field. The SELECT statement, if it is not SELECT @All, must precede the statements in the formula that it applies to.
5. This LotusScript code finds the sum of all OrderTotal fields in a database for one day, and writes a new record to the database containing the daily total. Each record in the database has OrderNumber, Date, and OrderTotal fields. The script finds all the documents in the database, then uses a loop and a comparison of dates to limit processing to today's documents. For each document, the script adds the OrderTotal to a dailyTotal variable. The script places the words "DAILY TOTAL" in the OrderNumber field for the document that it writes, and places the dailyTotal value in the OrderTotal field.
See Also