Running Asynchronously and Checking for Results

When you use RemoteRunNoWait to run Production Reporting programs on the server in asynchronous mode, the Production Reporting executable is invoked on the server and control returns immediately to the client application. Thus, the application is free to perform other operations while a long report executes, and to poll the server to see if the Production Reporting program has completed execution.

RemoteRunNoWait returns the unique filename of the Production Reporting program invoked on the server. This unique filename prevents multiuser conflicts. Use the RemoteGetResults method, and pass the unique filename to perform the "check if complete" operation. If the Production Reporting program has completed execution on the server, TRUE is returned and the SPF output is fetched from the server. You could then display the SPF output using the Production Reporting Open method. If the Production Reporting program is still running, TRUE is returned.

It is up to the programmer to implement how an application performs the "check if complete" operation. If made available within an application by the programmer, a user can launch the "check is complete" operation. To do this, add a menu item, toolbar button, button on a form, or some other control to the user interface of the application, and call the method RemoteGetResults from the event handler for the control.

If using Visual Basic, use the following code to invoke an Production Reporting program on the server in asynchronous mode. Adjust the values of myserver, mylogin, mypassword, myreport.sqr, dblogin, and dbpasswd to fit your particular environment.

Sqr0cx.RemoteConnect("myserver", "mylogin", "mypasswd"," ")
Sqr0cx.RemoteRunNoWait(
"myreport.sqr dblogin/dbpasswd", temp_sqr_file)
Sqr0cx.RemoteDisconnect

If using Visual Basic, use the following code to perform the "check if complete" operation. Once again, adjust the values of myserver, mylogin, mypassword, myreport.sqr, dblogin, and dbpasswd to fit your particular environment.

Sqr0cx.RemoteConnect("myserver", "mylogin", "mypasswd"," ")
While not Sqr0cs.RemoteGetResults("myreport.sqr dblogin/ dbpasswd"),
'the report is still running, do nothing'
Wend
RemoteDisconnect