The command that has caught me out today, not for the first time as well, is the view.GetDocumentByKey command. This seems like a fairly simple command and it is, it is very useful and I use it all over the place, however it does have what I think is a logical flaw. If you have a view containing a number of documents with the first column containing say a Town Name and this column is sorted.
Lets say we have a number of Documents covering various towns,
- High Wycombe,
- Reading,
- Marlow &
- Marlow Bottom.
Now there is a boolean parameter that sits on the end that will force it to perform an exact match, however by default a partial match is enough. For the novice developer this is very dangerous and I can speak from experience that it can cause major problems if you don't spot the need for the exact match.
An agent I wrote that went through a database each time a new document was created, checked against a particular number on the document to see if the doc number already existed with the same revision that the new document had and if there was such a document it was removed, as this new document was obviously supposed to overwrite it. For many weeks we tried to understand why sometimes documents with a zero on the end of the document number, went missing. Of course we eventually spotted the extra parameter and realised that if you created a Document 12345 Revision 1, if it didn't already exist in the system and Document 123450 Revision 1 did, that 123450 document would get removed.
That was the first time it caught me out and todays was the second hopefully I will remember to add the parameter every time from here on and there will never be a third!! So there you go, the first gotacha that you need to look out for if you are just moving into Lotus Notes Development.
1 comment:
i might have some developement work to put yer way soon if yer fecking interested, our developers just quit. the big fecking bastard
Post a Comment