uwa.groupRequests()

Previous Next

In order to speed up an application it is possible to group two or more actions into one Page Engine request, using uwa.groupRequests()". For example:

 

uwa.groupRequests(function(){

executeQuery("DEPT")

executeQuery("EMP")

executeQuery("PERSONS")

});

 

All function calls within uwa.groupsrequests() are sent to the server in one request and executed sequentially. uwa.groupRequests() can be seen as the dynamic version of handleEvent (StaticEvent).

 

NOTE: The default Web application does not use "uwa.groupRequests()". If you have several consecutive actions  that you want to group, place them in a function and call uwa.groupRequests() with that function.

 

In some cases, using uwa.groupRequests() may even be mandatory. This would be the case when multiple executeSQLStatement actions need to be executed, while depending on the outcome of previous actions, for example:

 

if        (answer)

{           uwa.groupRequests(function(){

                   checkData(true)

                   executeSQLStatement("PROMOTE_EMPLOYEE")

                   executeSQLStatement("RECALCULATE_BUDGET")

                   commit(true)

               })

               rollback(true)

};

 

The uwa.groupRequests() action always generates exactly one page engine request.

 

Related function: handleEvent()