IBM®
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

@DbLookup and @DbColumn have a little quirk that's not made really clear by the documentation. If you use an @Dbfunction against a view that the user has re-sorted by clicking a column heading, the @Dbfunction will return a result based on the user's selected sort order of that view, rather than using the default sort column (also known as the "primary collation"). This is true even if the view is not open at the time. I refer to this euphemistically as a "surprise feature." There are other names for it, one containing three letters and others containing four.

As you might imagine, problems caused by this disconnect between developer expectation and actual functionality are hard to track down, because when a developer tries to reproduce it, the view is probably not sorted the same way on their workstation as it is for the user having a problem. The user may not even have used the view in weeks -- it doesn't matter how long ago, their workstation remembers their custom sorting.

So this is one reason to use a separate, hidden view for your lookups -- even though you get better performance with fewer views. Another reason is maintainability -- user views are more likely to change than purpose-built lookup views. If someone adds or moves columns and you have a hardcoded column number in a lookup to that view, there'll be a problem.

Another little-known tip about lookups tomorrow.

Andre Guirard | 25 March 2008 05:07:00 AM ET | Caribou Coffee, Minneapolis, MN, USA | Comments (1)

Search this blog 

Disclaimer 

    About IBM Privacy Contact