I cam trying to do an @DBlookup in two fields, one called city and one called state. When the user enters the ZipCode, I want the @DBlookup to go to the “ZipCode” view and find the corresponding City and State. Here is my code:
@DbLookup(“Notes”:“NoCache”;“”:“”; “ZipCode”; Zip; 3)
“ZipCode” is the view, Zip is the field where the user enters in the zipcode, and 3 is the column number for the City.
what am I doing wrong!
Subject: @DBlookup, what am I doing wrong??
The ZipCode is the first column in the view, and it is sorted.
I have also altered the code to point at the server and the database, but I am still getting this error in the fields:
ERROR: Server Error: Entry not found in index
Subject: RE: @DBlookup, what am I doing wrong??
Can you show us all of the code so that we can see what is wrong?
Subject: RE: @DBlookup, what am I doing wrong??
@DbLookup(“Notes”:“NoCache”;“Server”:“Folder\database.nsf”; “ZipCode”; Zip; 3)
“ZipCode” = View Name
Zip = zipcode user enters in the form
3 = column value I want to return (city)
Subject: RE: @DBlookup, what am I doing wrong??
Not sure if you read my earlier post before I edited, but you need to have the key value in quotes, unless you are using it like below:
myzip := “Zip”
@DbLookup(“Notes”:“NoCache”;“Server”:“Folder\database.nsf”; “ZipCode”; myzip; 3)
Try that and let me know.
Subject: RE: @DBlookup, what am I doing wrong??
Your server name is “Server”? That does not look right to me. The way you have it coded is the key value should not be in quotes or it will use the literal value of the word “ZIP” for doing the lookup.
Is zip defined as a number or text?
Something like this should work:
database := @Subset(@DbName; -1);
server := @Name([CN]; @Subset(@DbName; 1));
@DbLookup(“Notes”:“NoCache”;server:database; “ZipCode”; Zip; 3)
Subject: @DBlookup, what am I doing wrong??
@DbLookup looks up a specified value in the first SORTED column of a specified view in a specified database.
Subject: @DBlookup, what am I doing wrong??
Your problem is that you are looking for a local DB. By putting in “” you are telling the lookup to perform a search on the local server where you are executing the code, which is your PC. Instead you could using something like @Subset(@DbName;1) which will tell the lookup to look at the server copy, which ever server the DB is on. Also the key needs to be in quotes.
Here is an example of one of mine:
@DbLookup(“”:“NoCache”;@Subset(@DbName;1):“”;“(lkplans)”;“REG”;5);
Hope that helps
Subject: RE: @DBlookup, what am I doing wrong??
That’s not actually correct Kelly.
If you’re looking up in the same database you can use “”:“”, or even just “” to specify the current database.
If you’re looking up a different database then “” for the server part means local (as in workstation), so for a different database on the same server you do need to specify the server name (I just use @servername these days).
Dan
Subject: @DBlookup, what am I doing wrong??
The formula you have entered appears to be correct provided that your view is titled (or preferably aliased) “ZipCode” and the 3rd column is your City value. Since you’ve already checked to make sure that the first column in your view is sorted (you DID check using the designer client making sure there are no hidden columns first?) the most obvious next issue would be the data type of your key field vs the data type in your sorted column. The help says the key is text. That may be what’s causing your problems, but I’d bet money that your key value and sorted column are of different data types.
On another note, if your lookup is structured correctly you could get back both the city and state with 1 lookup. Typically we will build a hidden column that has all of the info you want to return concatenated together. Do 1 lookup to that hidden column and use @Word (or some other variation) to split the returned value into the pieces you require. If you wind up needing a lot of info looked up from somewhere else your users will thank you for making it a speedy as possible. 
BTW, the other advice people have give you about the second parameter (server and filename) is slightly misleading. Specifying the server and filename as “” : “” (you can use just a single set of quotes if you like) is perfectly fine. It indicates look in THIS database (regardless of where that db resides - local or server). Only if you need to search in another database do you need to start specifying your server and file name.
Subject: RE: @DBlookup, what am I doing wrong??
I disagree with the slightly misleading comment. The help text clearly states
To perform a lookup on a local database, use “” for the server name and specify the database name explicitly, such as “”:“DATABASE.NSF.”
To perform a lookup (from the workstation) on a Domino database that resides on a server, include the server plus the path and file name as a text list, as in “SERVER”:“DATABASE.NSF.”
Although using a “” can work on, it doesnt always, esp in development code, it is best to put in the server name as the help text describes.
Subject: RE: @DBlookup, what am I doing wrong??
Yes, but before that line in the help it says:
To perform the lookup on the current database (the same database in which the formula is being evaluated), specify “” as the entire argument to the function. “” means the local Domino directory where you are executing.
As I said in my other post, this only applies if it is the current database, you need the servername part if you’re using a different database on the same server.
Dan
Subject: RE: @DBlookup, what am I doing wrong??
Thanks for pionting that out. I guess I never paid attention to it before. It explains why my lookup didnt work for me until I put in the servename.