Refresh NotesDocument variable

Hi all,

in my Postopen script of our main form, I do a db.search to find a specfic document that I put in a global variable so as to be abble to use it in other scripts of the form.

What is the best way to refresh this variable ? Because this specific document could be updated so I have to get its last version.

Do I have to make the same db.search again or is there an faster way (via search NoteID or UNIVERSALID, or others fields or via another method) ?

thanks

luc

Subject: refresh NotesDocument variable

look up refresh and reload methods in Help

Subject: refresh NotesDocument variable

Hi Yazdi,thanks for you answer.

Please tell me if I am wrong, but reload and refresh are working on NotesUIDocument object not on NotesDocument.

I had a look on UNID and ID.

So, I can save the ID of this document found thanks to my db.search and then use this ID in parameter of GetDocumentByID method so as to obtain the document refreshed.

Any other way ? Is this, the cleanest way to do it ?

luc

Subject: RE: refresh NotesDocument variable

well…GetDocumentByID do not the job…

Here is what I tried :

in my first script (postopen) of form B :

docA=db.search (myformula)

theID=docA.NoteID

messagebox docA.myfield

in the QueryClose script of the form B

Set docA = db.GetDocumentByID(theID)

messagebox docA.myfield

where theID is a global variable

Test :

I open a docB. myfield appears.

Without closing docB, I open docA, modify the field “myfield” and save the docA.

When closing docB, “myfield” of docA appears with its old value.

how can I get the newest docA (without db.search I hope because it’s too slow) ?

thanks

luc

Subject: RE: refresh NotesDocument variable

any idea, solution or advice ?luc

Subject: RE: refresh NotesDocument variable

For information…

it is working fine with getDocumentByUnid instead of GetDocumentByID.

so, seems to be a bug…

luc