It turned out to be what I'd term a "quirk" of the LotusScript compilation process and happened with only one of about six databases that I was testing. The reason that I'm writing about it is to assist others who might encounter the same quirk in future and hopefully give them a few ideas about resolving the matter and so save them some time and heartache.
It occurred when I tried to replace the NotesTracker V4 LotusScript subroutines in the Database Script design element of the database with their V5.0 editions. The new code steadfastly refused to compile and kept giving the "Name previously declared" error message.
Keep in mind that I had already updated the Database Script section of three or four other databases without encountering this, and it was indeed puzzling (and frustrating). I did all of the usual things: checked for duplicate name definitions (Dim statements), but there were none. Naturally I tried the "Recompile All LotusScript" tools option but that didn't fix the problem either.
I turned to Google search ( http://www.google.com.au/search?hl=en&q=%22name+previously+declared%22+lotusscript ) but nobody seemed to have reported exactly the problem I had.
There ensued more tearing out of hair, muttering uncomplimentary things about Lotus, blaming global warming, tossing salt over my left shoulder and incantations to the compiler gods -- all to no avail.
Then, in a burst of inspiration from the primitive "id" part of my brain I hit upon the solution (see image). I deleted the entire Database Script, as shown, and pasted exactly the same code back into the Declarations and subroutines areas of the now-empty Script.
And it worked! There was no compilation error and at last I was able to save the Script.
Go figure it out. I certainly can't.
Apparently something got "screwed up" in the internals of the Database Script's structure that caused perfectly legitimate code to fail.
So if you encounter this LotusScript error and all the usual techniques fail to get your code compiled, try this technique to clear out all of the code in that section (Database Script, or whatever) and paste the code back in.
A few hours lost, but a useful lesson learned: sometimes the LotusScript compiler will reject perfectly satisfactory code. In this case there's a chance that you can overcome the compilation problem by removing all of the subroutines in the object (the Database Script, or a Script Library), performing a Save (or Recompile All LotusScript), and then pasting it back unchanged.
I've coined a motto for such LotusScript quirky behavior:
Did this help you? Please let me know.If you can't beat it, delete it!... And then, repeat it.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.