Page History
...
In its simplest form, data can be returned directly to the fields and lists being displayed on the page by specifying them as the features to receive the data from the call to the SrvRoutine. Below, the SrvRoutine instance is defined and then immediately executed, with the returned data being mapped directly into a visual list component called #List.
Mthroutine Name(Load)
...
* Define the service instance and execute asynchronously
* Define the service instance and execute asynchronously
Define_Com Class(#ServerModule.GetEmployees) Name(#GetEmployees)
...
* Map the returned data directly into the list on the screen
* Map the returned data directly into the list on the screen
#GetEmployees.ExecuteAsync( #List)
...
Endroutine
...
Endroutine
Notice that the command used to invoke the SrvRoutine is ExecuteAsync, indicating to execute asynchronously. This means the RDMLX in the Web Page or Reusable Part will continue running while waiting for data to be returned from the SrvRoutine. If you were to process #List immediately after the ExecuteAsync you may be processing an incomplete set of data.
...
Extending this SrvRoutine, in the code below we put the returned data into an interim list and only process the list when we are notified that the SrvRoutine has completed. The Completed and Failed events have been added so that the application can monitor the server module processing and respond accordingly.
Def_List Name(#Employees) Fields(#Empno #Surname #Givename #Empthm …) Type(*working)
Mthroutine Name(Load)
...
* Define the service instance and execute asynchronously
* Define the service instance and execute asynchronously
Define_Com Class(#ServerModule.GetEmployees) Name(#GetEmployees)
#GetEmployees.ExecuteAsync( #Employees )
...
* When the server returns
...
* When the server returns
Evtroutine Handling(#GetEmployees.Completed)
* Load the list data
Selectlist Named(#Employees)
...
Add_Entry To_List(#List)
...
Endselect
Endroutine
* If the server call failed
...
Endselect
Endroutine
* If the server call failed
Evtroutine Handling(#GetEmployees.Failed)
...
* Error handling
Endroutine
* Error handling
Endroutine
Endroutine
| Note |
|---|
...
| Note: Lists can be returned into either a working list, as in this example, or a UDC. |
For more information on calls to Server Modules refer
...