Contact Information

Chris Toohey

    Publishings
    Remove my name from the Domino Directory!! 02/05/2008
    Lotus Notes
    Quick and Dirty Mail Application Document Importing 01/24/2008
    Methods and Strategies
    Addressing Domino Web-based @DBLookup limitations with Rich-Text and Context Profiles 12/16/2007
    Domino Web Development
    Dynarch Calendar - Date Blockers 01/25/2007
    Integrated Solutions
    Domino Flex Fields 11/03/2006
    Methods and Strategies
    Site Resources

    RSS Site Content
    Syndicate This Site!
    DG Banner Logo
    Advertisements

    IBM Lotus Notes and Domino 7 now available

    Quicktip: Web DBLookup API

    03/03/2008 03:50:49 PM | Chris Toohey | Bethlehem, PA

    This is quick-and-dirty, and something that I just put together for a friend of mine who's working on an ever-expanding (scope, that is...) project. It's simple and gets the job done, but can offer both an insight into more advanced architectures as well as a near-limitless application.

    Let's take a look at the @DBLookup Function in all it's glory:

    @DbLookup( class : cache ; server : database ; view ; key ; fieldName ; keywords )

    We'll go with the cookbook method:

    Ingredients

    Long list - I know.

    So, we'll start by creating a blank Navigator design element named "dblookup". Now, create a Form design element called "$$NavigatorTemplate for dblookup", setting the Content Type to "text/plain", and adding the following fields:

    The Body Formula:

    @DbLookup( @URLQueryString("class") : @URLQueryString("cache") ; @URLQueryString("server") : @URLQueryString("database") ; @URLQueryString("view") ; @URLQueryString("key") ; @URLQueryString("fieldName") ; @URLQueryString("keywords") )

    Disgusting isn't it?!

    It's usage:

    db.nsf/dblookup?open&cache=NoCache&view=someviewname&key=somekeyvalue&fieldName=returnfieldName&keywords=%5BFAILSILENT%5D

    This, as you can see, will do a "NoCache" DBLookup in the current database against the someviewname View for somekeyvalue, returning the value from the NotesItem returnfieldName, and returning "" (blank) when the lookup fails.

    The reason that I'm using Plain Text as the Content Type is to allow for usage with AJAX functions, and the Rich Text is used to allow bigger lookups. Need it to do something more, expand away!


    Comments

    Duncan Bradley
    03/04/2008 04:07:58 AM

    Why go to the trouble of the navigator & $$navTemplate when you can do it with just a form called dblookup? One less element to worry about!


    Patrick Kwinten
    http://quintessens.wordpress.com
    03/04/2008 04:44:16 AM

    I see the sense of using a navigator in stead of a form for a form is for me something you present to the end user or something you use for creating documents on the background.

    Great code!


    Rob
    dowork.com
    3/9/2008 2:58:35 PM
    How about a form with a hidden field into which you can load any formula language you wish; a whole script with @for and @while perhaps? Then the query save agent would do an eval on it and return the result. Of course you might have some security issues ... Rob:-]


    Add a New Comment


    (Not Published/Public)
    Remember my Information!

    (Enter the text from the image to proceed)

    (Full markup allowed in the comment field below; play nice!)

    Live Comments Preview