Subject: RE: Reload a UI Document with single action
John,
Are you sure that this works for you, because it doesn’t work for me?
Yes, it works if you make the back-end changes from the same client and I do this quite often as well.
But, what if the changes are made in another replica of the database and then replicated to the one that is open? Or the changes are made by another user on a different computer?
In your example, I expect that you will get a save conflict when you try to save (unless you are using a backend save with Force = True, in which case you will overwrite any other changes).
In the cases that interest me, the document is not open in edit mode, so I don’t need the first two steps that you list. Unfortunately, the sequence
uidoc.Close
ws.EditDocument(False, doc)
does not give me a completely fresh copy of the document. The only way I can get a fresh copy is to close first, then open it again in a separate operation. If the document is left open in any window at all, then even going back to the view and double-clicking does not get a fresh copy of the document.
Incidentally, I have found that the quickest (and I think only) way of testing whether I have a fresh copy of the document is to try doing a backend Save(False, False). If it fails, you know that something else changed the document.
Some of these characteristics have been obtained from experimentation. I don’t think the help spells it out very clearly. If I have missed anything, or anything I have said is wrong, please say so. Because I would love to have an operation for getting a completely fresh copy of the document and it always seems so strange that there is not one.