Making your lookups more readable and maintainable

SearchDomino.com member Erik Rydberg explains why, instead of performing multiple lookups, you're better off doing one lookup, getting a summarized value from a document, and then parsing out theinformation to different fields on the form.

VIEW MEMBER FEEDACK TO THIS TIP

@DBLookups are powerful and, usually, a fast way to find data within an application. When I first started developing Notes/Domino applications I used lookups everywhere, even if I was getting data from the same document. This is bad for performance.

After a while, I understood that a better way to do this was to do just one lookup, get a summarized value from a document, and then parse out various bits of information to different fields on the form.

To create a summarized string, you usually put some kind of separator between the values in the column formula, or even a hidden field on the form that does the computing of the summarized values -- for even better performance, since the view index will be faster.

For example, a normal string of several values might be: erik~rydberg~sweden~2. You can parse out any value with @left/@right or @word.

There are at least two problems with the above string -- both concern maintaining applications. First, it is hard to figure out what the values are (what does 2 mean in the above example?) Second, it is hard to change the order of the string, remove something that isn't needed anymore or add a value. You can't be sure that nothing is going to break, even if you just add a value at the end of the string – -- especially if you didn't build the application or it was too long ago to remember all the details.

I started to use the following syntax instead:

<firstname>erik</firstname>
<lastname>rydberg</lastname>
<kids>2</kids>.

I also changed the way I extract values from the string. Now I use @Middle instead. To get the number of kids: @Middle(string;"<kids>";"</kids>").

I think it is safe to say that the string is more readable even for someone who didn't develop the application in the first place. Also, it is a lot easier to change the string since it is not as order-sensitive as the old one was.


MEMBER FEEDBACK TO THIS TIP

This is a very good tip. It's very clear and easy to use, thanks!
—Linda T.


Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Erik Rydberg. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was last published in April 2006

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close