Uidoc.document causing document caching

Hi,

I’ve spent all day tracing down a really wierd bug in 6.5.3, and I’d appreciate people testing it on other versions on R6 if you have them. There’s a link at the bottom of this post to download a demo database to test it.

If I open a document and use either source.document or uidoc.document in an event, or action button etc, then it seems that Notes loads a cached version of the document into memory which is only released when the document is closed. This is fine for operations triggered on the document itself. The problem is that it also affects operations which take place elsewhere in the database when run from the same client while the document is open.

On my 6.5.3, if I do the following in the test database, I get the results described below.

  1. Open a document. The document contains a number field whose value is 1

  2. keep the document open and return to the view.

  3. Click the “Multiply” action - the value in the view column changes to 2

  4. Click the “check” action - this displays a msgbox of the number field - 2

  5. return to the open document. Click the “trigger Bug” action. This pops a message box using uidoc.document.form(0)

  6. return to the view, keeping the document open

  7. click the “multiply” action again. the field val in teh view now correctly shows 4

8)HERE’S WHERE THE BUG HAPPENS :wink: Click the check action - in 653, the msgbox now shows 1, becuase it’s using the cached data from when we clicked the action button on the document

  1. Close the document

  2. click “Check” - msgbox now shows 4

Any ideas on how to use uidoc.document.xxxx on a form while avoiding this? Am I doing something fundamentally wrong? does it work correctly in 654?

If you’d like to test this, you can download a zip of the test db from http://www.medders.org.uk/bugtest.zip

Appreciate your comments

Kiers

Subject: interesting problem…

i ran in 6.5.1 with same results.

i guess you just asked of a way to avoid/trap it…

i was able to trap it with the following in the check agent:

If doc.IsUIDocOpen Then

Msgbox doc.value(0) & " - Yes"

Else

Msgbox doc.value(0) & " - No"

End If

But note, this only worked after clicking the “trigger bug” in the uidoc (following the steps listed).

Subject: RE: interesting problem…

Thank you!!!

that’s excellent - I’d not heard of that call - guess I should read the manual…

I can use that in our app to check for if this situation has occured.

Many many thanks.

Kiers