Examples: ColumnValues property (NotesDocument - LotusScript®)
- You retrieve a document called currentDoc from a view that has
two columns: the first shows the due date of a project (its column
formula is the field DueDate), the second describes the project (its
formula is "New Project: " + Description).
On the currentDoc, the DueDate item contains 10/16/95 and the Description item contains "Ad Campaign for Acme." Therefore,
currentDoc.ColumnValues(0) equals 10/16/95 currentDoc.ColumnValues(1) equals _ "New Project: Ad Campaign for Acme"
- You want to look up all the products in the Products view of an
Inventory database. This script finds the view and then visits each
document in the view to retrieve its first column value (which holds
the product name). This is equivalent to performing an @DbColumn.
server$ = "Tilburg" dbfile$ = "inventor.nsf" counter% = 1 Dim db As New NotesDatabase( server$, dbfile$ ) Dim view As NotesView Dim doc As NotesDocument Dim productList( 1 To 100 ) As Variant Dim currentProduct As Variant Set view = db.GetView( "Products" ) Set doc = view.GetFirstDocument While Not ( doc Is Nothing ) ' Get the value on the current document that shows up in ' view's first column ' Append this value to our productList array currentProduct = doc.ColumnValues( 0 ) productList( counter% ) = currentProduct Set doc = view.GetNextDocument( doc ) counter% = counter% + 1 Wend ' There are now counter% - 1 items in the productList
- This view action displays all view column values.
Sub Click(Source As Button) Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument Dim i As Integer Dim j As Integer Set db = session.CurrentDatabase Set view= db.GetView("Status") Set doc = view.GetFirstDocument Forall value In doc.ColumnValues ' if scalar If Datatype(value) < 8704 Then Msgbox value,, "Column "& i ' if multiple values Else j = 0 Forall subvalue In value Msgbox subvalue,, "Column "& i & ", value " & j j = j + 1 End Forall End If i = i + 1 End Forall End Sub