Retrieve Items from the Collection

Visual LANSA

Retrieve Items from the Collection

In the DragDrop event of  the list on the second form a list collection is defined and the payload containing the collection of selected employees is cast to it.

Define_Com Class(#Prim_LCOL<#Employee>) Name(#EmployeePayLoad) Reference(*Dynamic)

Set_Ref Com(#EmployeePayLoad) To(*Dynamic #PayLoad)
 

The list collection is iterated through in a For/EndFor loop to retrieve the employee details:

For Each(#EmployeeObject) In(#EmployeePayLoad)
Change Field(#EMPNO) To('#EMPLOYEEOBJECT.PEMPNO')
Change Field(#GIVENAME) To('#EMPLOYEEOBJECT.PGIVENAME')
Change Field(#SURNAME) To('#EMPLOYEEOBJECT.PSURNAME')
Change Field(#POSTCODE) To('#EMPLOYEEOBJECT.PPOSTCODE')
Add_Entry To_List(#DROP_LIST)
Endfor

 

Ý List Collection Example 2