Get keyword function

Here a simple LotusScript function that I use quite a lot to get keyword values:

Function Get_Keyword(dbCurrent As NotesDatabase, sKey As String) As NotesDocument
 Dim viewKeywords As NotesView
 Dim docReturn As NotesDocument
 Set viewKeywords = dbCurrent.GetView(“v-keywords”)
 Set docReturn = viewKeywords.GetDocumentByKey(sKey)
 Set Get_Keyword = docReturn
End Function

Usage:

Set keyword = Get_Keyword(dbCurrent, “keyword_key”)

where keyword_key is the first fieldvalue in the view to search for…

Advertisements

3 thoughts on “Get keyword function

  1. Pedro Quaresma 2007-October-4 / 1:04 pm

    You could pass the view name as a function parameter as well, instead of having it hardcoded.

  2. Stephan H. Wissel 2007-October-5 / 11:18 am

    Nice function. I wouldn’t add the view as parameter, since looking up keywords in views is only *one* way to get a keyword. The better one is to use a profile documents as a cache. Then you can’t use a view name.
    🙂 stw

  3. quintessens 2007-October-5 / 2:12 pm

    Yes but we all know how nice caching goes with testing/writing an application. But some awareness to use profile documents in a production environment in stead of keywords is recommended, yes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s