The .Domino Framework provides the LotusScript equivalent for many @Functions. These can be found in the Domino.@Functions namespace.
Note: Because LotusScript does not allow the "@" character to be used for function names I have adopted the naming standard of atf (AT Function).
I have just expanded the functionality of the atfDBColumn to provide support for NotesDocumentCollections. This may not be the most efficient way to achieve the result, but it is a very fast way to code the need to get a list of field values from a database/view/document collection - e.g. when prototyping. The expanded atfDBColumn method provides the ability to:-
- Pass either a database, view, or document collection as the source.
- Request either the contents of a column number or fieldname to be returned.
'/**
' * Returns an array containing the list of values for a specific column/field for any collection of documents
' *
' * @author Peter Presnell
' * @param ClassCache Not used
' * @param Database NotesDatabase object, server/filepath, or replicaid id, or Nothing (current database)
' * @param View NotesDocumentCollection, NotesView, name of view, or Nothing (All documents in database)
' * @!param Column Column number or name of field corresponding to values to be returned
' * @return List of values
' */
Function atfDBColumn(ClassCache As Variant, Database As Variant,View As Variant, Column As Variant) As Variant
Dim iDB As New NotesDatabase("","") ' Database to perfrom lookup
Dim iCollection As Variant ' View/Document Collection used to perfrom lookup
Dim EntryList As NotesViewEntryCollection ' List of all entries in view
Dim Entry As NotesViewEntry ' Current entry in view
Dim Doc As NotesDocument ' Document that corresponds to current entry in view
Dim ColumnValues As Variant
Dim Results As Variant ' Interim results
Dim Index As Long ' Counter used to loop through array
Try:
On Error Goto Catch
' Setup database/view
Redim Results(0)
Select Case Typename(Database)
Case "NOTESDATABASE"
Set iDB = Database
Case "STRING"
Call iDB.OpenByReplicaID(Session.CurrentDatabase.Server,Cstr(Database))
Case "STRING ()"
If (Ubound(Database) = 1) Then
If Database(1) = "" Then Set iDB = Session.CurrentDatabase Else Call iDB.Open(Database(0),Database(1))
End If
End Select
Select Case Typename(View)
Case "NOTESDOCUMENTCOLLECTION"
Set iCollection = View
Case "NOTESVIEW"
Set iCollection = View
Set iDB = iCollection.Parent
Case "OBJECT"
If iDB Is Nothing Then Set iDB = Session.CurrentDatabase
Set iCollection = iDB.AllDocuments
Case "STRING"
If (iDB Is Nothing) Then Set iDB = Session.CurrentDatabase
Set iCollection = iDB