Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on May 07, 2020, 05:17:32 am



Title: Ask Reuben 18 - How To Allow The User To Safely Stop A Long Running Operation
Post by: Reuben B. on May 07, 2020, 05:17:32 am
When a program performs something that takes some time to run, such as a loop, a report, a long running database query etc, the front-end has no control.  The runtime is not sitting waiting for an INPUT, MENU etc to be responded too.  However you might want to allow the user to stop the report, database query, batch update etc, typically in case they have entered the wrong parameters, or it is taking longer than expected.

The technique is to have an action-view, typically a button, with the special action name “interrupt”.  When the runtime is executing the long running processes, this button will become active.  The user can then click the button, and an asynchronous interruption request will be sent to the program.

When the run-time receives this event, it will set the INT_FLAG variable to TRUE, and so your code can test if an interrupt has occurred by checking the value of the INT_FLAG variable.

Read more at https://4js.com/ask-reuben/ig-18/