Link to home
Start Free TrialLog in
Avatar of khanhna
khanhna

asked on

dblookup

Hi experts,
I have a Notes view which has 2 column: FirstName and LastName.
FirstName     LastName
AAA             A1A1A1
BBB              B1B1B1
CCC             C1C1C1

In another form, I have a field named LN (computed) and the value for this field is:
FIELD LN:= @DbLookup("": "NoCache"; "":"";"ViewName";"AAA";2);

In fact it will return A1A1A1 but it does not. Error msg is "ERROR: Server error. Entry not found in index". I have tried: with some views it run OK, with others it returns this error. I have check but cannot find out the reason.
Please help. Thanks, Na.


ASKER CERTIFIED SOLUTION
Avatar of Bozzie4
Bozzie4
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And you need to catch errors.  Rewrite the formula, put this in the formula field for the computed field:

res:=@DbLookup("": "NoCache"; @dbname;"ViewName";"AAA";2);
@if(@iserror(res);"Error";res)
for the field LN, place below formula:
res:=@DbLookup("": "NoCache"; "Servername":"dbname.nsf";"ViewName";"AAA";2);
@If(@Iserror(res);"";res)

view first column should be sorted and should be a string.
Tom,
I am seeing similar variable( res) is used so many times between us. Coincidence.
I did not saw your answer. Else I wouldn't posted.
I don't know where I got this "res" from, but I've been using it for many years now.  I think it's used in the Help, or maybe in a Lotus Course or something ?
But if you want to claim "res" as your own, I'll use something else from now on :-)

cheers,

Tom
Avatar of p_partha
p_partha

even i use res , must be from help :)

Partha
yeah. May be.
No need to shift to another variable TOm. Let us use the same.
Maybe the error here is simpler than not catching the @DbLookup error, which sould be catched always.

If the ViewName expression in the formula is the name of a variable or a field, the formula should read:
  FIELD LN:= @DbLookup( "":"NoCache"; ""; ViewName; "AAA"; 2 );


PS: "res" clearly stands for "result", but it also means "(a) thing" in latin... :-) like "res publica", which means "the state"

Are you sure that the column does contain "AAA". Isn't it possible that it contains spaces? A better idea will be to modify the column formula to trim(firstname) and discard/rebuild the index prior to testing it.