Perform Lookup For Each Value In Multi-Value Field

There are times when you need to lookup information on each value in a
multi-value field. When doing so, @DbLookup or @DbColumn would not work.

This code looks into the Areas field on the current document; Looks up the
Areas field values and gets the Manager of each area from the Process Area
view. It then sets the value of the Managers field on the current document to
the value of all of the Managers of each Area. You can then use @Unique in
your input validation or a separate field to only show a Manager's name once
when they happen to be a Manager of more than one area.

The Process Area view is made up of a column displaying Process Areas and a
column displaying the Manager of each Process Area. This information is
gathered from a separate form that designates Process Areas and their Managers.
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim item As String
x = 0

Dim area_array() As Variant

Set db = session.CurrentDatabase
Set view = db.GetView("Process Area")
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

Redim area_array(x) As Variant
area_array(x) = ""

Forall i In doc.Areas

x = x+1
Set doc = View.GetDocumentByKey(i)
item = doc.Manager(0)

Redim Preserve area_array(0 To Ubound(area_array) + 1) As Variant
area_array(x) = item

End Forall

Set doc = uidoc.Document
doc.Managers = area_array
This was first published in November 2000
This Content Component encountered an error



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...