Subject: Replace values in a range of documents using lookup list
I would do this with Lotus Script. This is how I would do it:
Create a form called ACLookup
Two fields at least: MarketingUnit and AccountCode
Create a view with two columns:
col 1: MarketingUnit
col 2: AccountCode
sort on col1
Next, the hard part…populate the ACLookup documents with the hundreds of Account Codes, one per Marketing Unit. You can import this from a spreadsheet, if you want to try that I can help you with it as well.
Once these docs are created, confirm they show up in this new view. Let’s call that view “(ACLookup)”
Now your agent to populate the large number of documents you want to update with the proper ac code:
(this is without me testing, so if I make a mistake, sorry)
Agent Name = “Populate AC Codes”
script:
Initialize
On Error Resume Next
Dim s As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim dc As notesdocumentcollection
Dim lookupdoc As notesdocument, doc As notesdocument
Dim counter As Long
counter = 0
Set db = s.currentdatabase
Set view = db.getview(“(ACLookup)”)
Set dc = db.unprocesseddocuments
Set doc = dc.getfirstdocument
Do While Not (doc Is Nothing)
Set lookupdoc = view.GetDocumentByKey(doc.MarketingUnit(0))
doc.AccountCode = lookupdoc.AccountCode(0)
If doc.save(True,True) Then
counter = counter + 1
print "Updating " + cstr(counter)
End If
Set doc = dc.GetNextDocument(doc)
Loop
Msgbox “finished updating " + Cstr(counter) + " documents”
end sub
I think that will do it. Give it a try.