@DBLookup problem returning wrong results

I am trying to use @DBLookup in a computed field on a form called “Info” in a database called “People.nsf” to return the value of the “Company” field that uses a form called “UserProfile” in a view called “LookupAgents” in the database named “WebReg.nsf”. The current formula in my computed field is returning the name of the database WebReg.nsf when it should be pulling up the name of the Company. I am using a configuration document to point to the server.

@Text(@DbLookup(“”:“NoCache”;“”:@Subset(@DbName;-1);“WebConfig”;“WebConfigDoc”;“DBWebReg”));Company:=@DbLookup(“”:“Nocache”;“”:DbReg;“LookupAgents”;“UserProfile”;“Company”);

Can someone tell me what I am doing wrong? I am new to Lotus Formula language and need help! Thanks for your time…

Subject: @DBLookup problem returning wrong results

I think the issue is that your using the form name where you should be putting your “key” value for the lookup in the view (second to last parameter).

Subject: RE: @DBLookup problem returning wrong results

thanks for your quick reply… I tried your suggestion - I get the error “A view of that name cannot be found in the specified database”. It seems that the problem is getting the DBLookup to recognize the servername. Are there any settings on the server I need to change, or do you have any other suggestions. Thanks again for your help.

Subject: @DBLookup problem returning wrong results

First, you say you need to pull data from a database called “WebReg.nsf”. Then your formula tells it to look into the current database (People.nsf). I think I hear you saying that you need to pull the Company field’s data from a document (UserProfile) that is sitting in the WebReg.nsf database.

This is what I think you need:

che:=“”:“NoCache”;

db:=“”:“WebReg.nsf”;

view:=“LookupAgents”;

key:=whatever_your_key_is;

fieldname:=“Company”;

@DbLookup(che;db;view;key;fieldname;[FAILSILENT])

Let me know if this doesnt work. Your LookupAgents view has to have the first column sorted with a value of whatever_your_key_is

Does that make sense?

  • Matt

Subject: RE: @DBLookup problem returning wrong results

MattThanks a million times for spelling that out for me. It finally works! I didn’t have my first column sorted by key.

Thanks again

Debbie

Subject: @DBLookup problem returning wrong results

A couple things I noticed from what you posted:1. You said you were pulling info from a Company field, yet you listed company as a literal string in your look-up - ie: use Company instead of “Company” in your dbLookup.

  1. You need to specify which column of the view your returning, see example below is returning column 2.

try this…

@DbLookup(“”:“NoCache”;“”;“LookupAgents”; Company ; 2 ; [FailSilent])

Cheers!

Subject: RE: @DBLookup problem returning wrong results

Thank you very much for your help. I tried your suggestion and fooled around with it a little, but all attempts give me errors like “entry not found in index”, “A view of that name cannot be found in the specified database”, “File not found”. It seems to be a problem with the servername and performing the DBLookup from the current database to the database that is storing the information… I’ll keep playing around with it - but just don’t understand why it doesn’t work.Thanks again :slight_smile:

Subject: RE: @DBLookup problem returning wrong results

Jeremy:

FYI - In @DBLookup, the field name should be enclosed in quotes. I know it does not follow practice (logically) but if you look in designer help that’s the way it supposed to be.