0

A Lotus script calls a Java agent and passes parameters to it in an In-Memory-Document. The agent performs some computations and reports its progress in a property of the shared document. A Timer on the form periodically checks the value representing the progress in the document and updates the UI accordingly.

The agent, having accomplished some progress, says:

doc.replaceItemValue("Percent", String.valueOf(percent));           
doc.save(true, false);

The timer on the forms loads the document periodically and tries to read the value like this:

Set doc = db.GetDocumentByID(parDocId)
percent = doc.getItemValue("Percent")(0)
Call    uidoc.FieldSetText("Percent", percent)

The problem is that the changes done by the agent are not read by the timer until the agent is completely done with the processing. So the GUI is not updated until the 100% finally appears.

I am wondering whether there is a better way to do this.

I tried to let those components communicate through environment variables, but those are restricted operations which I would prefer not to use.

AHH
  • 981
  • 2
  • 10
  • 26
  • Does your Java agent have `Run in Background Client Thread` property enabled? – nempoBu4 Jul 14 '14 at 09:40
  • This is another issue. I enabled it, but it didn't really thread the agent, so I wrote my own threading! – AHH Jul 14 '14 at 09:43
  • 1
    If you are calling your agent from UI without this property then UI is blocked and waits for the agent to finish its work. Timers as part of UI are blocked too. – nempoBu4 Jul 14 '14 at 09:49
  • I've just tried with this property on, the agent now works in the background but the value is not being updated. – AHH Jul 14 '14 at 09:52
  • Try to enable this property and reopen database in your timer like I writed [here](http://stackoverflow.com/a/24697402/1805640). – nempoBu4 Jul 14 '14 at 09:56
  • Late comment, but might be helpful: Attempt locating the document with its Universal ID instead of Note ID. Sounds stupid but it works differently, and I've previously solved some issues like this. – Sam Sirry Feb 27 '20 at 01:36

0 Answers0