Domino 9 und frühere Versionen > ND6: Entwicklung

GetDocumentByKey method works strange

(1/2) > >>

Toma Bogdan:
I use the following code to search within another DB using the ID filed (a number field)

--- Code: ---Set dbB=New notesdatabase (dbA.server,path$ + "a_doc.nsf")
Set view=dbB.getview("(DOCS)")
Set target=view.getdocumentbykey(L(i),True)
If Not (target Is Nothing) Then
   Set uidoc = ws.EditDocument( False, target )   
Else
   Messagebox("The doc doesn't exist or can't be accessed !")
End If
--- Ende Code ---

the view (Docs) located in the a_doc.nsf DB contains just a single sorted column (ID) for the GetAllDocumentsByKey method to work.

When I try to find a doc that exist in the second DB (a_doc.nsf), I receive the above script message (The doc doesn't exist or can't be ...) even it exist !  ???

where is the mistake ?

10x

koehlerbv:
From my experience GetDocumentByKey works without any problems at all.
Is your column in the view in the other database really sorted ?
Do you really use the value with L (i) which you expect ?

A few days ago somebody reported problems with values of the data type Double and GetDocumentByKey with a specific Notes version. A workaround for that was to use string variables instead of number variables (I always use GetDocumentByKey with string values): Change your sorted column to @Text (IDField) and use string variables in your array L, too.

HTH,
Bernhard

Semeaphoros:
I too think, that searching with strings will be mor reliable than searching with numbers, when using GetDocumentByKey

TMC:
Well, Toma, would be interesting which result you receive when using a string variable instead of a number variable.
The user, Bernhard mentioned above, was first using a long variable and had no problems. Only when he was using a variable of the data type Double an error occurred.

Please let us know your result.

Toma Bogdan:
well, I have converted the key to a number Set target=v.getdocumentbykey(Cint(L(i)),True) and it works now ! it was my mistake  ::)


--- Zitat von: Semeaphoros am 15.06.04 - 18:12:28 ---I too think, that searching with strings will be mor reliable than searching with numbers, when using GetDocumentByKey

--- Ende Zitat ---

is it true ?

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln