One way to get a collection of documents from an AbtLnDatabase is to use the allNotesFromQuery: method. A query is a formula, like a view selection formula. See your documentation about writing formulas using the formula language of Domino.
Here is a code sample that retrieves documents from the provided sample database that have been stored with the Response form:
| localConnection sampleDatabase queryFormula answerSet| "Initialize your runtime system" AbtLnEnvironment startUp. "Create a local connection" localConnection := AbtLnConnection local. "Open the sample database" sampleDatabase := localConnection openDatabase: 'vasample\vasample'. "execute the query to get all the documents which were stored using the 'Response' form" answerSet := sampleDatabase allNotesFromQuery: 'SELECT Form="Response" '. "print the contents of the documents which matched the query to the transcript window" answerSet do: [ :document | Transcript nextPutAll: document fill printString; cr. ]. "close the database" sampleDatabase close. "Deinitialize" AbtLnEnvironment shutDown.
You may have noticed that the query returns a collection of AbtLnNote instances. An AbtLnNote is a generic representative for a Domino document. For more details on documents see Using the Domino Form part (AbtNotesFormPart). After you have executed the sample code, your Transcript window should display contents like the following text:
an AbtLnNote[ an AbtLnItemText(Form ==> 'Response') an AbtLnItemRefList($REF ==> '$REF') an AbtLnItemText(From ==> 'Hans Kamutzki') an AbtLnItemText(ImmediateParentSubject ==> 'AbtLnEnvironment') an AbtLnItemText(NewsLetterSubject ==> 'Take care when you save image (Response to: "AbtLnEnvironment")') (Body ==> ) an AbtLnItemText(OriginalSubject ==> 'AbtLnEnvironment') an AbtLnItemText(ParentForm ==> 'MainTopic') an AbtLnItemText(readers ==> '') an AbtLnItemText(ThreadId ==> 'HKAI-343ANV') an AbtLnItemText(Subject ==> 'Take care when you save image') an AbtLnItemTextList($UpdatedBy ==> OrderedCollection('Hans Kamutzki' )) ] an AbtLnNote[ an AbtLnItemText(Form ==> 'Response') an AbtLnItemRefList($REF ==> '$REF') an AbtLnItemText(From ==> 'Hans Kamutzki') an AbtLnItemText(ImmediateParentSubject ==> 'AbtLnConnection') an AbtLnItemText(NewsLetterSubject ==> 'Single Connection, many applications (Response to: "AbtLnConnection")') (Body ==> ) an AbtLnItemText(OriginalSubject ==> 'AbtLnConnection') an AbtLnItemText(ParentForm ==> 'MainTopic') an AbtLnItemText(readers ==> '') an AbtLnItemText(ThreadId ==> 'HKAI-343AP8') an AbtLnItemText(Subject ==> 'Single Connection, many applications') an AbtLnItemTextList($UpdatedBy ==> OrderedCollection('Hans Kamutzki' )) ]
Be aware that a string in a query is put in double-quotes rather than single-quotes.