Using GetDocumentByKey with Numerical Values Returns Incorrect Document or No Document

When you use the LotusScript GetDocumentByKey method (of the NotesView class) with a numeric value for the key, either no documents are returned or the incorrect document is returned.You must convert both the column formula and key to string values in order to perform the lookup. You should edit the column formula, adding an @Text function call to the present formula. The key values passed to the GetDocumentByKey method can be converted to string values by using the Cstr function. The dimension, or Dim, statement for the key array must now be declared as a String or Variant.

Example:

Using the @Text function in a column formula. Given a formula which contained the entry ‘numfield’:

@Text(numfield)

Using the Cstr function to convert the desired key value:

keys(0)= cstr(doc.numfield(0))

Lotus Software KnowledgeBase Document# 1101037