3.3.2 Server Processing
Data and server side processing can be accessed through the use of Server Routines (SrvRoutines) coded in a Server Module.
The source example below shows a server routine that builds a list of all the employees in the table xEmployee, as well as the thumbnail image, then returns the complete list to the calling Web Page or Reusable Part. Data is sent in JSON format and converted to the corresponding LANSA fields and lists automatically on the Client end.
Def_list Name(#employees) Fields(#xEmployeeIdentification #xEmployeeSurname #xEmployeeGivenNames #xEmployeeImageThumbnail …) Type(*working)
SrvRoutine Name(GetEmployees)
List_Map For(*Output) List(#Employees)
* Get all employee data
Select Fields(#Employees) From_File(xEmployee)
* Get the employee thumbnail image. Stored as a Blob
Fetch Fields(#Employees) From_File(xEmployeeImages) With_key(#xEmployeeIdentification)
Add_Entry To_List(#Employees)
Endselect
Endroutine