My Excel VBA macro currently reads through all documents in a database using “View.GetNextDocument(doc)” and testing the contents to locate those that match my target.
Is there a way to access a specific document in a notes document database?
My Excel VBA macro currently reads through all documents in a database using “View.GetNextDocument(doc)” and testing the contents to locate those that match my target.
Is there a way to access a specific document in a notes document database?
Subject: You are correct
Yes Carl, I am. Unfortunately just being an IBM employee doesn’t automatically make one aware of where the resources are, and this is my second day using Developer Works. I am also a neophyte when it comes to this “stuff”. Thank you for the link. That’s very helpful.
Subject: There used to be really good internal forums
where questions could be asked of Product Managers etc. Not sure if they still exist. If I was you, I would try sending a note to Mat Newman (He’s in Oceana), he will know someone internally that can probably help you, or have example code.
Subject: Domino Designer Help isn’t available
Thank you Carl,
Unfortunately with Notes 9.0 Client I no longer have access to Domino Designer Help. I’ll have to locate a good book.
I am essentially trying to write a UDF that will loop through a set of Notes documents that share the same key, adding up one of the columns, and exiting. As simple as this seems, to someone with no Lotus Script knowledge it’s a real challenge. This is what I have pieced together through various “experiments”. If anyone has a similar process they could share I would certainly appreciate it.
Function ApplianceSoftwarePercent(Requested_D_PartNumber As Range) As Long
Dim i As Long 'Row index for active worksheet output
'Each document contains 5 key data fields
Dim TopLevelPart As String
Dim SubPartNo As String
Dim SubPartGLAccount As String
Dim SubPartDivision As String
Dim SubPartPercent As Long
’
Dim TotalSWGPercent As Long 'Total Percentage of period revenue going to Software Group
'Define Excel Objects
Dim session, db, dc, View, doc, strShtName
'Initialize Notes Session with Server and Open the view
Set session = CreateObject(“Notes.NotesSession”)
Set db = session.GetDatabase(“CAMDB01/CAM/A/Lotus”, “d_dir\salesbomdb2.nsf”)
Set View = db.GetView(“By Top Bill SubID”)
'Initialize the variables
ApplianceSoftwarePercent = 0
QualifiesAsLicense = False
Set ShtName = ActiveSheet
i = 2 'Begin listing subpart data on active worksheet, row 2
'Collect all documents whose TopLevelPart = Requested_D_PartNumber from the worksheet
'Read the first document in the collection
Set doc = View.GetFirstDocument
'While the document part_num = Appliance_D_PartNumber
'GLAccount = doc.GetItemValue(“GLAccount”)
'SubPartDivision = doc.GetItemValue(“ibm_whlsl_div_code”)
If SubPartGLAccount = “330-0100-000” And ibm_whlsl_div_code = “7H” Then
'TotalSWGPercent = TotalSWGPercent + Percent
TopLevelPart = doc.GetItemValue(“part_num”)
SubPartNo = doc.GetItemValue(“cmpnt_part_num”)
SubPartPercent = doc.GetItemValue(“split_pct”)
'List Sub Part Data on Active Worksheet
ShtName.Cells(i, 2) = TopLevelPart(0)
ShtName.Cells(i, 3) = SubPartNo(0)
ShtName.Cells(i, 4) = SubPartGLAccount(0)
ShtName.Cells(i, 5) = SubPartDivision(0)
ShtName.Cells(i, 6) = SubPartPercent(0)
'Pick up the next document in the collection
Set doc = View.GetNextDocument(doc)
'Increment the Active Sheet row counter
i = i + 1
End If
Loop
'No more documents for this Top Level Part
'Return the percentage
ApplianceSoftwarePercent = TotalSWGPercent
End Function
Subject: You’ve got internet access right?
The 8.5.x code stream is fine for your issue.
IBM Developer http://www.ibm.com/developerworks/lotus/documentation/dominodesigner/
Also judging by the Domino server name, don’t you work for IBM? Doesn’t IBM have documentation available to you?
Subject: Yes
You can use a number of methods.
If you know the document ID you can use getdocumentbyID/getdocumentbyUNID
If you have a view sorted by a unique key for each document, you can get document by key
They’re all documented in to the Domino Designer help look for the document titled "Accessing documents in LotusScript classes "