Skip to main content
    Country/region select      Terms of use
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

Notes/Domino developers sometimes need a keyword list that exceeds the Notes formula limitation of 64KB. In a Notes client application, without using picklist, how do you do this?

In the particular case, I had a view containing many names, and I wanted a dialog list field that would let me select from among them. Here's how the field is defined, then:

keyword formula:
@If(!@IsDocBeingEdited; @Return(@Unavailable); "");
_shorts := @DbColumn(""; ""; "shortLookup"; 1);
@If(@Length(@ThisValue) >= 2; @DbLookup(""; ""; "Pirates"; @Left(@ThisValue; 2); 1; [PartialMatch]:[FailSilent]) : _shorts;
_shorts )

Since the field is set to refresh fields on keyword change and refresh choices on document refresh, it refreshes its own choices when its own value changes. The view "shortLookup" is categorized with the formula @Left(Name; 2), so reading its first column returns a list of all the valid first-two-letters of valid selections. The view "Pirates" is the one containing all the valid choices, which we would just use @DbColumn on if that didn't return too much data.

Once we have two letters to work with, the formula does a partial-key lookup to retrieve all the values that begin with those letters (but we always offer the full list of first-two-letters also, in case the user changes their mind).

So from the user's perspective, if they open the helper dialog, they don't initially see a list of all the choices; they see all the first two letters. If they select from this list or type two letters, they'll then be able to see all the choices beginning with those two letters. But the list of all the first two letters are also still available in case they made a mistake.

Depending on your data you might choose more or less than two letters as the trigger for your initial lookup, or you might even do it in phases; two letters to get a list of all the first-six-letters beginning with those two letters, then once they get to six letters, all the choices matching those six. That's a little more complicated but the principle is basically the same.

Some points:

  • To use this technique you must have a form designed to not mind refreshes -- for instance, validation formulas need to test @IsDocBeingRecalculated and avoid failing validation in that case.
  • Because of frequent refreshes, this and your other lookup-based formulas also need to be efficient, testing the edit mode as we do here, and making sensible use of caching. I think Domino developers generally should actually pry out the NoCache key on their keyboards to avoid using it thoughtlessly.
  • From a UI perspective, it might be nice to append an ellipsis to the _shorts value ( _shorts := @DbColumn(""; ""; "shortLookup"; 1) + "..."; ) to clue users in that the value is incomplete -- if you can do this without risking exceeding 64K.
  • The input validation formula for this field will need to know to reject the two-character values.

Andre Guirard | 16 December 2009 11:30:13 AM ET | Home, Plymouth, MN, USA | Comments (3)

Search this blog 


    About IBM Privacy Contact