Reading document contents
Fields in a document can be easily accessed using the at: method. All fields in a note have a unique name which is a String (except some special cases to be discussed later). To support the dictionary-like protocol of an AbtLnNote, there is an at:ifAbsent: method as well.
Note:
Some names are reserved for Domino internal use. See your Domino documentation for reserved and internal field names. If you need to look at field names using the Notes client, use the "Document Property" context window.
All fields are typed. There is a set of data types defined in Domino which maps to corresponding Smalltalk classes. In addition to that, these Smalltalk classes feature implicit conversion routines to Smalltalk base classes. The following example shows how to read all fields within a document retrieved from the sample database provided with Domino Connection.
| sampleDatabase note |
"Initialize runtime system"
AbtLnEnvironment startUp.
"Open the local mailfile"
sampleDatabase := AbtLnConnection local
openDatabase: 'VASAMPLE\VAMAIL'.
"Read the first note from the query results and load the contents"
note := (sampleDatabase allNotesFromQuery: 'SELECT Form="Memo"')
first fill.
"Iterate through the fields in the document and print
information to the Transcript"
note allItems do: :item |
Transcript nextPutAll: 'Fields class: ';
nextPutAll: item class printString; cr;
nextPutAll: 'Field Name: ';
nextPutAll: item name; cr;
nextPutAll: 'Field contents: ';
nextPutAll: item contents printString; cr; cr.
].
"Close the sample database"
sampleDatabase close.
"Shutdown runtime system"
AbtLnEnvironment shutDown.
Last modified date: 01/29/2015