LOTUSSCRIPT/COM/OLE CLASSES


Examples: GetDocumentByKey method
1. This agent gets the first document in the first category that begins with Leather in the By Category view of the current database and displays the price.
2. This script gets the first document in the category "Spanish leather" in the By Category view of the current database. The name of the category must be exactly "Spanish leather" except for case.
3. This script examines the By Category and Author view of the current database, which categorizes documents by category and, within each category, by author. The script gets the first document in the Expense Report category whose author is Robson Da Silva.
4. This field script gets a user's full name from a field on the current document, parses the full name to find the last name, and then uses GetDocumentByKey to find the user's office phone number in the People view of the Address Book on the current machine. It places the phone number into the Phone field on the current document.
5. This script gets all of the documents in the category "Spanish leather" in the By Category view of the current database, and puts them in the Boots folder. The script finds the first document in the category using GetDocumentByKey, and the remaining documents in the category using GetNextDocument. The script uses the ColumnValues property in NotesDocument to check each document's column values: as long as a document's value for the first sorted column in the view equals "Spanish leather," the script places the document in the Boots folder. If the document's value for the first sorted column does not equal "Spanish leather," or if there are no more documents in the view, the script ends.
See GetAllDocumentsByKey for an easier way to do this. The only advantage to this technique is that it correctly sets the ColumnValues property in the retrieved documents while GetAllDocumentsByKey does not.

See Also