Manage Learn to apply best practices and optimize your operations.

Evaluate @Isdocbeingedited On Mode Chage (The Better Way To Prevent Lookups In Read Mode)

I frequently use @DBLookup & @DBColumn to populate choices for keyword fields.
Depending on the target of these lookups, they may result in an undesirable
performance hit. I've always wanted to optimize them so the lookups don't get
executed when the document is opened in Read mode. Lotus gives us a function
(@IsDocBeingEdited) to do exactly that. Just format your keyword formula as

@If(@IsDocBeingEdited; @DbColumn("" : ""; "ServerName":"DatabaseName";
"ViewName"; ColumnNumber); KeywordFieldName)

This formula does the lookup if the doc is in Edit mode or simply returns the
value that is currently in the keyword field if the doc is in Read mode.
Unfortunately, the formula does not evaluate when a doc was opened it Read mode
and is then changed to Edit mode. As a result, keyword choices are not
available in the particular scenario. This bug is well documented in Technote

Until I came up with a workaround, this bug prevented me from using
@IsDocBeingEdited because the side effects were unacceptable.

Just put the following code in the Querymodechange event of your form.
NOTE: If you need the same functionality on several forms, you could easily
create a new subroutine in a Script Library that contains the same code (You
will want to pass Source as a parameter).
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If Source.EditMode Then
'User is going from Edit mode to Read mode. No action required.
'User had doc opened in Read mode, they are now switching to Edit
'Need this code to make the lookups work in this scenario.
Dim ws As New notesuiworkspace
Dim doc As notesdocument
Set doc = Source.Document
Call Source.Close
Call ws.EditDocument(True, doc)
End If
End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...