Retrieve the Items in the Collection

Visual LANSA

Retrieve the Items in the Collection

The form retrieves the values in the sorted collection by defining a reference to the employee list and then invoking the method in the reusable part to get the employees.

Define_Com Class(#Prim_SACO<#Employee>) Name(#ReturnedList) Reference(*Dynamic)

 

Invoke Method(#LCOL00002.GetEmployees) Employeelist(#ReturnedList) Orderby(#Sort_By_Field)
 

The collection is iterated through to add the entries to the visible #Emp_List:

 

 
For Each(#EmployeeObject) In(#ReturnedList)
 
Change Field(#EMPNO) To('#EMPLOYEEOBJECT.PEMPNO')
Change Field(#GIVENAME) To('#EMPLOYEEOBJECT.PGIVENAME')
Change Field(#SURNAME) To('#EMPLOYEEOBJECT.PSURNAME')
Change Field(#POSTCODE) To('#EMPLOYEEOBJECT.PPOSTCODE')
Change Field(#DEPTMENT) To('#EMPLOYEEOBJECT.PDEPARTMENT')
Change Field(#SALARY) To('#EMPLOYEEOBJECT.PSALARY')
 
Add_Entry To_List(#EMP_LIST)
 
Endfor

 

Ý Sorted Array Collection Example