Autor Thema: GetDocumentByKey method works strange  (Gelesen 3100 mal)

Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
GetDocumentByKey method works strange
« am: 15.06.04 - 16:54:27 »
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

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

Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Re:GetDocumentByKey method works strange
« Antwort #1 am: 15.06.04 - 17:08:19 »
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

Offline Semeaphoros

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 8.152
  • Geschlecht: Männlich
  • ho semeaphoros - agr.: der Notesträger
    • LIGONET GmbH
Re:GetDocumentByKey method works strange
« Antwort #2 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
Jens-B. Augustiny

Beratung und Unterstützung für Notes und Domino Infrastruktur und Anwendungen

Homepage: http://www.ligonet.ch

IBM Certified Advanced Application Developer - Lotus Notes and Domino 7 und 6
IBM Certified Advanced System Administrator - Lotus Notes and Domino 7 und 6

Offline TMC

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 3.660
  • Geschlecht: Männlich
  • meden agan
Re:GetDocumentByKey method works strange
« Antwort #3 am: 15.06.04 - 23:59:43 »
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.
« Letzte Änderung: 16.06.04 - 00:07:58 von TMC »
Matthias

A good programmer is someone who looks both ways before crossing a one-way street.


Offline Toma Bogdan

  • Aktives Mitglied
  • ***
  • Beiträge: 146
  • Geschlecht: Männlich
  • That's me ...
    • A nice site !
Re:GetDocumentByKey method works strange
« Antwort #4 am: 16.06.04 - 09:21:46 »
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  ::)

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

is it true ?

Offline Semeaphoros

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 8.152
  • Geschlecht: Männlich
  • ho semeaphoros - agr.: der Notesträger
    • LIGONET GmbH
Re:GetDocumentByKey method works strange
« Antwort #5 am: 16.06.04 - 13:15:07 »
Yes, thats true, probabily with integers you don't have much troubles (but you cannot be sure about that). With any real data type I am pretty sure, that you will run into problems, as the machine is plagued by rounding problems and hence it has a lot of difficulties to get a correct "equal" value, this is an inherent problem with any computing.
Jens-B. Augustiny

Beratung und Unterstützung für Notes und Domino Infrastruktur und Anwendungen

Homepage: http://www.ligonet.ch

IBM Certified Advanced Application Developer - Lotus Notes and Domino 7 und 6
IBM Certified Advanced System Administrator - Lotus Notes and Domino 7 und 6

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz