How often do you use the “Recompile All” feature in the Lotus Designer? Periodically, I get error messages that pop up in a large database I support after design refreshes. The error messages themselves on incorrect. For example, I’ll get a “Duplicate puble name” error when there are no duplicates. The only thing that makes it go away, it seems, is a recompile all. My trouble with this “solution” is that it seems drastic; everything gets signed with a new updated date. That means things that were working fine now appear as though they’ve been modified. This causes more things to be replicated than is necessary. Even more, though, the team of developers lose track of when something was last “really” worked on, which is often a useful piece of information. So I’m wondering how often people use the feature and if others have had errors (and fixes) like I’ve described.
Archive for the ‘Lotusscript’ Category
Recompile All
Posted by therightnotes on May 16, 2007
Posted in Lotus, Lotus Notes, Lotusnotes, Lotusscript | 5 Comments »
SNTT: Opening subforms quickly
Posted by therightnotes on April 19, 2007
This is a tip that has been around awhile, but it is so unbelievable that I wanted to share it in case you haven’t seen it. In other words, this doesn’t originate with me, and I’ve forgotten where I found it originally.
As most of you know, subforms are slow. A form with multiple subforms is particularly slow, even if the subforms aren’t computed (which, of course, slows the loading of the form further). There is one easy way to make subforms load quickly: Put some lotusscript code–Any Code!–in the initialize event of every subform. We use something like this:
Dim fastOpen as boolean
fastOpen = True
If you have a form with multiple subform, this simple, meaningless code that does nothing makes a HUGE difference in load time. I have no idea why adding code makes the subforms load faster, but it does (at least in Notes 5 and 6). Give it a try!
Posted in Lotus, Lotus Notes, Lotusnotes, Lotusscript, Show-n-Tell Thursday, SnTT, best practices | 7 Comments »
Formula Language vs Lotusscript
Posted by therightnotes on February 15, 2007
Like a lot of developers, I tend to you formula language for simple task and Lotusscript for more complicated tasks. I always figured that–at least for simple items–formula language was optimized and thus faster.
Yesterday, though, my tester commented that a particular action–a typical bulk approval–seemed to be running more slowly at one level than at the previous level. The previous level had a fair amount of logic and new field creation, so that agent was written in Lotusscript. This final approval was very simple, and so I had written an agent like the following in formula language:
FIELD AppDate:=@now;
FIELD Approver:=@name([cn];@username);
FIELD Status:=”Approved”;
select @all;
The agent ran on selected documents. Since it was slow, I quickly wrote the equivalent in lotusscript:
Option Public
Option Declare
%INCLUDE "lsconst.lss"
Sub Initialize
Dim sess As New notessession
Dim db As notesdatabase
Dim dc As notesdocumentcollection
Dim thisdoc As notesdocument
Dim nextdoc As notesdocument
Dim goodcount As Integer
Set db = sess.currentdatabase
Set dc = db.unprocesseddocuments
Set thisdoc = dc.getfirstdocument
If dc.count = 0 Then
Messagebox "Please select at least 1 recommendation", MB_ICONStop + MB_OK, "Bulk Approval"
Exit Sub
End If
Do Until thisDoc Is Nothing
Set nextDoc=dc.GetNextDocument(thisDoc)
With thisDoc
.MCAppDate = Now
.MCApp=sess.CommonUserName
.status="Approved"
End With
goodcount=goodcount + 1
Call thisdoc.Save(True, False)
Set thisDoc=nextdoc
Loop
Messagebox goodcount & " compensation recommendations approved." , MB_ICONInformation + MB_OK, "Bulk Submit"
End Sub
Sure enough, this simple Lotusscript agent ran much faster than the formula equivalent; my tester estimate 5x faster. The question is why? Is formula language simply not as fast as I thought? Is the overhead of the progress bar that automatically appears when users run a formula language agent so high that any optimization is overwhelmed? I’m not certain, but the performance upgrade is noticeable enough that I’m not likely to try to write even simple agents in formula language anymore.
Posted in Domino, Lotus, Lotus Notes, Lotusnotes, Lotusscript, Show-n-Tell Thursday, SnTT, agents, formula language | 1 Comment »
Coding for client and web
Posted by therightnotes on February 9, 2007
At my company, we have been mandated to code for both client and web use. As I talk to people, this is becoming more common, but there are many challenges. To me, one of the biggest challenges is the amount of stuff that has to be done twice. We all know that Notes can produce web applications “out of the box,” but they are, frankly, terrible: page refreshes abound, layout is difficult to control, and the Java applets that were cool when they first came out aren’t useful to most of us today.
One area I have been focussing on is the outline. We have a few applications where the outline changes regularly (I think that is fairly unusual for an application, but I could be wrong). To maintain both a client and web version is a nightmare, so I wrote an agent to generate HTML based on the outline. This works well for simple outline entries like links, but it forces us to avoid using formula language which may be supported on the web but which I don’t know how to translate in a lotusscript agent. So, for example, instead of writing an outline entry with an action of @command([compose];”MyForm”), we use a named element of Form type that opens MyForm. Both work, but I think most developers think more like the former than the latter option. I’ve got an idea on how to make even this work…if I figure it out, maybe some magazine will want to publish it. If not, I’ll share it here.
Posted in Domino, Lotus, Lotus Notes, Lotusnotes, Lotusscript, web programming | Leave a Comment »
Writing to the Document Universal ID
Posted by therightnotes on February 1, 2007
This isn’t so much a “show-n-tell” as a description of how a feature can be used.
To me, one of the more curious aspects of the NotesDocument object is the fact that the UniversalID field is read/write. For a long time I wondered why anyone would want to write to the unique identifier. It seemed incredibly dangerous! If you weren’t careful, you could end up with duplicate IDs, and that could play all sorts of havoc. I was really shocked that Lotus had left that property writeable.
Then, one day, one of the users of a client-facing Quickplace deleted the welcome page. As you know, domino databases can generate fairly ugly URLs that include the document uniqueID. This QP was no exception, and numerous users (both internal and at the client site) had saved the site as a favorite. All of a sudden, their favorites stopped working.
You can see where this is going. I was able to get the URL that some users had saved, recreated the welcome page, and then ran an agent to give it the same universalID that the former page had. Our problem went away.
And I was very glad that Lotus had made that property writeable.
Posted in Lotus, Lotus Notes, Lotusnotes, Lotusscript, Show-n-Tell Thursday, SnTT, quickplace | 4 Comments »