Tip

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.