< Back

Document Subject: Golden Rule No1: Error check @DblookUps and @DbColumns
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#GR1 or http://A555F9/nn.nsf/ByAlias/GR1
Golden Rule No1 Error checking @DbLookup and @DbColumn. What is the Golden Rule? Why follow this Golden Rule? Exceptions to the rule. How do I fix the problem when it occurs?

What is the Golden Rule?

Always error check @dblookup and @dbcolumn.

i.e. putting

@dblookup("""""Keywords""Subject"2)

in a field is not good enough.

It should be:

r:= @dblookup("""""Keywords""Subject"2);

@if(@iserror(r);"Keyword \"Subject\" not found." r )

Why follow this Golden Rule?

If a form has a field that has a @Dblookup or @DbColumn that fails, ie because the lookup value doesn't exist or the column is empty then the form will not load and will give the error:

"Server Error: Entry not found in index"

The user will be really happy about that won't they?

You will know exactly which field is incorrect as well won't you? NOT!

Exceptions

I have not seen a valid reason not to do this.

If you are using multiple @Dblookups in a formula then test each one before you

combine them.

Make sure you add the error checking in Keyword Choices formulae as well, because a web page

will not load if the choices formula comes up with an error.

The "I didn't check it to optimise the speed" argument is ridiculous as the extra processing time

is minimal.

I have heard that using temporary fields with @dblookup or @dbcolumn causes memory leaks and

the error: Too many concurrent formula evaluations, please retry .

How do I find the culprit field?

If a document can not display on the web then try opening it in Notes, and follow hints below.

If a document can not open in Notes, try putting

@prompt([ok];"Debug""In field xxx");

before each field's computed value, this will allow you to find out which field is stopping the form from loading. Scatter the prompts around the fields on the form. Put more prompts in fields close to the problem area, until you narrow it down. Make sure you put in the field name in the prompt so you can easily remove them!

Alternatively, make a copy of the form design, then remove fields from the form until the form loads. This will also help you narrow down to which field is causing the problem.