Agent Status on Web

I have a web app where a user clicks a “Create Additional” button that opens a pop up window using a form in the db. In this popup the users enters a number to specify how many additional documents they want created based on the document from which they clicked the"Create Additional" button.

I would like to inform the user on the progess of the agent that is creating the addtional documents. Something along the lines of “3 of 7 additional documents have been created” after each document is created. I’ve tried using PRINT statements in my code but it seems they only get processed and sent back out to the popup window after the agent completes.

I’ve considered using AJAX but I think the issue is more with the agent not spitting the PRINT statements out until the agent has finished running. Has anyone found a way to show the status of an agent that is initiated from a web browser?

Subject: Agent Status on Web

Yes, Print statements only get returned after the agent is finished or dies. The only way I know to do a check on the status is to do something like this:

Submit form

WebQuerySave agent is run when submitting the form. It checks the total number of documents needed, say NeededDoc field, with a value of 7, then checks how many are created from another field, say CurrentDoc field, 0, to start with. It creates a document, increments the CurrentDoc field, then returns to the form (now a document). When the document loads, it hides the fields, tables, etc if the CurrentDoc field is not zero, and instead displays a computedtext field stating the status of the document creation (i.e. “1 of 7 documents created”). Also, in the onLoad event, if the CurrentDoc field is not Zero (0), and not equal to NeededDoc field, then it automatically resubmits the document again. This process is then performed again.

After all the docs are created, both CurrentDoc and NeededDoc fields are equal, and a new computedtext value is displayed saying it’s done.

There you go. I’ve done this many times, and it works nicely. I’ve never done it for only one document at a time though, more like 100 at a time, but it should be ok for only one at a time too.

Enjoy!

Tim Williams