This example is otherwise the same as the List Collection Example 1 except that the drag and drop operation involves more employee details and these details are stored in an employee object:

The Employee Object
The employee object is used to store employee details. This object is then used in the collection for the drag and drop operation.
The object defines and publishes these employee properties:

Define the Collection
A list collection is created dynamically  to be the payload for this drag operation. It is a list collection of #Employee objects. A #DragEmployee variable is created to store the employee objects to be inserted in the collection. Because the collection is dynamic, a reference is set to it using the SET_REF command:
 
Define_Com Class(#Prim_LCOL<#Employee>) Name(#PayLoadList) Reference(*Dynamic)
Define_Com Class(#Employee) Name(#DragEmployee) Reference(*Dynamic)
Set_Ref Com(#PayLoadList) To(*Create_as #Prim_LCOL<#Employee>)
Add Items to the Collection
A Selectlist loop is used to add the selected employee objects to the list collection. The list collection is then set as the payload for the drag operation:
 
Selectlist Named(#DRAG_LIST)
Continue If('#Drag_List.Currentitem.Selected *ne True')
Set_Ref Com(#DragEmployee) To(*Create_as #Employee)
Set Com(#DragEmployee) Pempno(#Empno) Pgivename(#GiveName) Psurname(#Surname) Psalary(#Salary) Pdepartment(#Deptment) Ppostcode(#PostCode)
Invoke Method(#PayLoadList.Insert) Item(#DragEmployee)
Endselect
Set_Ref Com(#PayLoad) To(#PayLoadList)
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
Source Code for List Collection Example 2
Employee Object
Create the object as a reusable part. In this example it is named #employee.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_OBJT)