http://panther.sharedknowledgesystems.com:81/sharedknowledge/sksblog.nsf
01/28/2005 03:01:16 PM - Coding @DBLookup - taking another look.

Permalink Coding @DBLookup - taking another look.




As developers become comfortable with a development environment they develop habits of coding that tend to continue even as the development environment is enhanced to make coding easier. This occurs for several reasons: old habits die hard; code library reuse; copy & paste from other applications. For these reasons, you like I may not remember that error handling for @DBLookup was made easier in Notes/Domino 6.
Recently I was hand coding a formula that included @DBLookup and had a senior moment which sent me to the Designer Help database. There I noticed an additional keyword parameter. The one that caught my eye and was used immediately was [FAILSILENT]. This keyword allows @DBLookup to return a null string should the function fail for any reason.

Prior to using this parameter my standard error handling for @DBLookup looked like this:

FieldName:="fd_Products";
ViewName:="va_LUProductLine";
Key:=fd_ProductLine;
Retval:=@Explode(@If(fd_kw_Products!="";fd_kw_Products;@DbLookup("";"";ViewName;Key;FieldName));";")
@if(@Iserror(Retval);"";Retval);


No I can eliminate the last line of the formula by adding the [FAILSILENT] keyword like this:

FieldName:="fd_Products";
ViewName:="va_LUProductLine";
Key:=fd_ProductLine;
@Explode(@If(fd_kw_Products!="";fd_kw_Products;@DbLookup("";"";ViewName;Key;FieldName;[FailSilent]));";")

Two other keywords are available: [PARTIALMATCH] and [RETURNDOCUMENTUNIQUEID]. The first allows for returning non-exact matches. The return values need only match the first few characters in the lookup key. The second keyword, [RETURNDOCUMENTUNIQUEID], returns the UNID of the document(s) found instead of a field or column value.

So now I've changed my coding habit to include [FAILSILENT]. I hope when the occassion arises I will remember the other two keywords and not use old habits to get the same results.



Comments

No documents found

Add Your Comments



Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:-) :-D ;-) :-( :angry: :-o :grin: :cool: :laugh: :huh: :cry: :rolleyes: :-x :-p :-\ :emb: :lips:






Remember me    

Add Manual Trackback
Please enter the details of the trackback post. Your trackback will not appear on the site until it has been verified. This may take up to 10 minutes.

Site Name

Permanent URL of TrackBack Post

Title of Post ( If Any )

Excerpt of Post ( Max 250 Chars )



Calendar
February 2012
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29