In the QueryOpen Event there is no reference for the backend document

Hi there,

opening a document in a form, one has access in the Queryopen event to the NotesUiDocument, but the property NotesDocument is not yet instantiated; the document simply does not yet exist, the value is nothing.This is not very practical.

It makes sense to not give yet access to the content of the document because restrictions defined in this event etc. may apply and dod not allow to acces the doucment. But a document reference, like in LS: Set doc=db.createDocument, would allow to have the reference to anmpty document which later (i.e. Postopen) gets its content.

The Postopen event is not necessariyl the next event triggered after the Queropen in a form, dependend on how the form was build, it can be another event. Thus one always has to write code in these events that assumes that the backend document was not yet set. And that can cause preventable errors.

Yes, if the timer interupt would allows a 10th of a second and not only integer seconds then one could use such a timer to set the backenddoc when available and stop the timer if done.

Yes one also could create an "On Event Postopen from Source" to catch the moment when the doc is completly available. But then the Postopen Event can not longer be used for @Formula, it has to be LS.

To explain my problem a bit more in detail: We use a generic LS library (ยง) for all design elements. That allows us to skip these repeating and reapting standard Notes declaration and instantisations : Set WS= , Set DB = , Set Doc = etc. Everything works fine , but Doc has to be a Property Get command and this is really bad if one has to debug code.

Or do you guys have an idea how one can already have a valid reference to the backend document in the Queryopen?

Thanks in advance (TIA)

Jochen "Joe" Herrmann

BTW. The Designer help search is nearly unusable

When you run into QueryOpen (after Form title) , you just can continue or not, after que QueryOpen event you got into initialize/values of all objects in the from top down. Once all fields (items) events are fired, you run into postopen and in the postopen you do have the complete NotesDocument. So you should instantiate the Doc in postopen not in queryopen.

Hello Jerome,

thanks for your reply.

After the Queryopen the Postopen is not necessarily the next event triggered when you open i.e. the document with Automatic edit mode enabled. I think there were even more exceptions. The queryrecalc and postcalc, if used are among those.

Kind regards,

Joe

Yes I did a sum up, if you set form to edit mode, when opening a document you run into querymodechange, postmodechange etc. Depending if you do it from the view (CTRL+E) or when the form is dispayed of when propery is set in form.....

What you can do, in all events put msgbox (for ls), @prompt (for notes) alert (for Javascript) and you'll get all events in the correct steps. I've did that for Notes dev 3 courses, I'll try to grab the original db, not sure I've kept it.

@Jochen Herrmann , HCL did give info on all events if that is sufficient:

https://help.hcltechsw.com/dom_designer/10.0.1/basic/H_TABLE_OF_EVENT_SEQUENCING.html

@Jerome Deniau,

thanks for your replies.

Did this already by using a NotesLog on disk. This way no UI restrictions can mix the output up.

Thanks.