I have always maintained documents in my private Notes Address Book (NAB) to save access time using the type-ahead feature. I have also added new fields to my personal documents to maintain other information about my contacts. My problem was that the public NAB is updated daily, while my private NAB is not.
Generally this is not an issue, but my company merged with another and everyone's e-mail address changed, causing my e-mails to fail. This situation magnified when the company issued me a laptop and I often worked offline. Not having access to the public NAB all the time, I had to make sure my personal NAB was kept up to date.
I could not do a full replication because I did not want the entire public NAB on my laptop. I could not do a partial replication because my added fields would be eliminated. I had to devise a method of updating the information in my personal NAB without changing the fields I did not want touched.
The following code accomplished just that while maintaining the integrity of the documents. I run this on a daily schedule so each time I am connected to the network, my private NAB is updated with the most recent information.
Basically I do a GetDocumentByKey using the employee ID as the key. With this, I retrieve all the fields in the public document (excluding the Notes maintained fields that begin with "$", plus a couple others I am not interested in) and match them to the same fields in my private documents.
In doing this, there are 4 scenarios that can happen:
1) Both the public and private fields are identical, in which case I do nothing.
2) The public and private fields have the same number of entries (fields are returned as arrays), but have different values, in which case I roll th
To continue reading for free, register below or login
To read more you must become a member of SearchDomino.com
');
// -->

rough the values in the field and copy only the items that do not match.
3) The field in the public document has a different number of entries than the field in the private document, in which case I replace the entire field in the private document with the corresponding field in the public document.
4) A public document is not found because the person left the company and their document has been removed from the public NAB, in which case I clear the field containing the employee ID in the private document to prevent processing the document in the future (I do not delete the private document because of the added fields being maintained).
The only prerequisite to this process is that you need a view in both the public and private NABs that list the documents by the key you are using. In my case, the public NAB has a hidden view called "(ByCellPhoneNumber)" (this contains the Employee ID (go figure?!)) and I created a hidden view in my private NAB called "(byEmpID)". Both identify documents with {Type = ("Person" : "Company") & CellPhoneNumber != ""}.
One other thing: To add a new document to the process, simply copy the Public Document to the private NAB and it will be automatically processed in the next cycle.
(Note: I have Msgbox's embedded for clarity. Since I run this on a schedule, I use Notes Logging and send the log to my mailbox to trap messages.)
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Bob Vezzuso. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.