Subject: RE: ArrayGetIndex - What if there’s more than one instance?
Hi Matthew,
As Harkpabst pointed out, you could build a “compound key” for your list and then eah list member need only contain a scalar value rather than a vector. So when building up your list, you could do somthing like:
Dim view as NotesView
Dim doc as NotesDocument
Dim strKey as String
Dim listLookup List as NotesDocument
'Get reference to the view you are using for lookup and then…
Set doc = view.GetFirstDocument
Do While Not doc Is Nothing
'Assuming all docs have valid values (or conversely, do a check first), …
strKey = doc.GetItemValue(“InvoiceNumber”)(0) & “_” & doc.GetItemValue(“InvoiceTotal”)(0)
Set listLookup(strKey) = doc
Set doc = view.GetNextDocument(doc)
Loop
Now, when trying to search for the matching invoice, you need only supply the invoice number and total as elements to the key in order to see if you found a match. For example, assuming that you are processing text file from which you read the invoice number and total into variables:
strKey = strInvoice & “_” & strTotal
If IsMember(listLookup(strKey)) Then
Set doc = listLookup(strKey)
Call ProcessPament(doc) 'call some custom function on this document
Else
'Not found… Log it?
End If
Now if I have misunderstood what information you have available to you from the bank, i.e. they don’t even supply you the invoice number, you can still use a list but one whose key is just the value and whose elements are NotesDocumentCollections (one way of storing vector data into a list item) but you have a bigger issue to deal with than that, I think.
If “Fred” and “Barney” both owe $100.00 whose account is creditred with Fred’s payment? Does Fred end up paying Barney’s debt?
If Fred makes a partial payment of $80.00, will his account be credited or because there was no match for an $80.00 invoice total, his payment is not processed?