More on @DBLookup

Which is faster, @DBLookup or @GetDocField? It seems none of us can agree either way. My own perspective is that it probably doesn't make much of a difference. Maybe if you plan on doing 10,000 calls to either method then you'll start to notice a difference, if indeed there is one. In practice it's unlikely you ever will.

What is for sure is that @Formula in whatever form can be both simple and extremely powerful. It never ceases to amaze me what you can do with a few lines of function calls. So much so that it's only ever a last resort that I turn to LotuScript.

As Chris Melikian pointed out on Wednesday, you can eliminate the need for the loop I was using with one line of code, because @DBLookup can take a multi-value key:

@Implode("<a href=\"" + @WebDBName + "/0/" + RelatedArticles + "\">" + @DbLookup( ""; "" ; "luArticles"; RelatedArticles ; "Title"; FailSilent ]) + "</a>"; "<br />");

In the above code RelatedArticles field is a list of document IDs and the result is a list of links with the title of the document as the text. The only drawback is that there's no way of dealing with deleted documents. Even though we've told the DBLookup to fail silently, which, in theory returns a "" null string (according to the help document), it actually returns nothing at all. If you dp a DBLookup with a seven-item key and two documents have been deleted the resulting list will only be five elements long. The null strings seem to be trimmed for you. The concatenation process then goes on to fill out the links with the titles of other documents in the list. It works but only until you start deleting documents!

Interestingly, you can't do the same thing with @GetDocField which doesn't like having a list passed to it.

Never underestimate the power of @Functions! Which reminds me of this Edit Any Field Smarticon tip from Breaking Par. Very useful if, like me, you were making-do with a half-baked solution that relied on you entering the name of the field and then a text value to assign to it.

Have good weekends y'all.


    • avatar
    • veer
    • Mon 5 Jul 2004 09:39


    I was mighty impressed with the "Edit Any Field Smarticon" by Breaking Par. I do this all time, when I write fix agents to modify field values. But...., ( there should a but here isnt it ), how I wished they could work on multiple selected documents.

    On your @dblookup, did you find a workaround? I was thinking that maybe you put the entire "<a href"+...+"</a><br/>" in the view column and do only implode of results from the field. I dont know how much of a performance hit this will be. I do this a lot in my apps, but they are not high usage ones.

    • avatar
    • Jake
    • Mon 5 Jul 2004 09:50

    That would work veer. I'm not looking for a workaround though really. I was happy with the loop and just wanted to pass on the idea/promote discussion/fill a void in the blog ;-)

  1. That's the way multi-value @DbLookups work -- return values cease on the first error. If the first key value fails, you will get either an @Error or "" if you've used [FailSilent]. If the second one fails, you get the rsults from the first only. If the third, then you get the result for keys 1 and 2, and so forth. That's why a loop is still a good idea -- if ItemA is missing, but Items B, C, D, etc., are still there, you'll never know it.

    • avatar
    • Jake
    • Fri 5 Nov 2004 05:31

    I never thought I would have to question Stan The Man but I see something different. Say the first two in a list of seven are missing. The result is a list of seven where the first five are the last five and the last two and the last one repaeated over.

  2. On what version, Jake? I ask because the @DbLookup-with-list behaviour is well-documented, and something I've tested before myself. If it's changed and stable, I'd like to know about it.

    • avatar
    • Jake
    • Fri 5 Nov 2004 16:39

    See! I knew this would happened if I questioned you Stan. Feelings of self-doubt start to appear.

    It's in Domino 6. I will double check tomorrow that I've got the exact behavious right...

  3. It wouldn't be the first "universal truth" that's been changed with time, Jake. Lotus may have changed the behaviour, and if they have, then the new behaviour is a {missing word} of a lot more useful than the old was.

  4. Dear All,

    Can u please sugget how to use Listsbox by useing java script. e.g. suppose i have few item in my backend DB2 and want to display all item in a list form by using script.


Your Comments


About This Page

Written by Jake Howlett on Fri 7 May 2004

Share This Page

# ( ) '


The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content