getDocumebtByID() BUG!

Hello

I am writing a generic function in LS called getDocument( key as String )

where key could be a universal id, note id or some other key.

The function searches first by note id, then by universal id and finally for some other key. see code below ( I omit error handling for brevity )

set doc = db.getDocumentById( key )

if doc is nothing then

set doc = db.getDocumentByUNID( key )

if doc is nothing then

let say I have a document like this

UNID = ACL16018A08E583C9F9EA862572BF005CEEAE4

NOTE ID = 00020ED2

these are a real universal id and note id of a document.

If I run the code using the unid above I expect getDocumentId to fail and then the program

to try the getDocumebtByUNID. But what getDocumentById actually does is to use the last 8 digits of the unid as a note id and does the search using 005CEEAE4 ( which is obiously the wrong note id). if this value happens to be a real note id of another document then the function returns the wrong document.

obviously the solution is to switch conditions but my point is that this behaviour is a bug since is not specified in the help section for getDocumentbyID()

This is actually happening in an application and messing some data!

Subject: Doesn’t seem like a bug to me…

I don’t think there’s value in our documenting every possible reaction to every possible input. Is it really useful to the developer to have this behavior documented? There’s such a thing as too much information, that tends to bury the stuff they actually need to know.

I realize it might have been useful to you, but I disagree with your technique. You have IDs and you don’t know whether they’re note IDs or UNIDs or key values? It doesn’t make sense. Why would you waste time calling a function that looks for the wrong kind of ID, as opposed to testing the length and content of the ID first so that you know what type it is and can call only the right function?

At any rate: if you feel the documentation is incomplete and wish to suggest an update, there’s a feedback link on the bottom of every help page. We have staff assigned to process this input.

Subject: My Suggestion: A little more bullet-proofing

If Len( key ) = 32 Thenset doc = db.getDocumentByUNID( key )

Else

set doc = db.getDocumentById( key )

End If

if doc is nothing then

Sincerely,

Grant