You are here: Web Apps with Visual LANSA > 20. Tips and Techniques > 20.3 Asynchronous vs Synchronous Database Access > 20.3.2 Asynchronous Processing

20.3.2 Asynchronous Processing

Asynchronous requests allow the browser to continue to respond, with the result that the application is still usable. When the request completes, the Completed event is fired for the SrvRoutine and the data can be processed. If the Web Server is slow to reply, the User Interface is still active, so the user can still navigate around the application. This has the potential to cause issues if the processing that occurs on completion of the server request changes the behavior of the application.

Unlike Synchronous Requests, Asynchronously Processing provides a break, allowing the User Interface an opportunity to update.

In this example, the application would behave precisely as intended, with details being hidden and then shown again when the data is returned:

Evtroutine Handling(#List.ItemGotFocus)
    #Details.visible := False
   #GetData.ExecuteAsync(#Data)
 
   Evtroutine #GetData.completed
      #Details.visible := True
   Endroutine
 Endroutine