Step 1 Create Employee Payload Object

VLF Windows Application Development

Step 1. Create Employee Payload Object

VFW112 – Drag and Drop between Components

In this step you create two components.

  • A simple Employee Object to store properties for each employee.
  • An Employee Payload object which contains a list collection of the Employee Object, containing the employees being transferred.

1.  Create a new Reusable Part / Object:

     Name: iiiVFW35

     Description: Employee Object

2.  Define properties uDepartment, uSection, uEmpNum and uFullname.

     The properties should automatically set and get the corresponding field values.

     Your code should look like the following:

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_OBJT)
Define_Pty Name(uDepartment) Get(*auto #deptment) Set(*auto #deptment)
Define_Pty Name(uSection) Get(*auto #section) Set(*auto #section)
Define_Pty Name(uEmpNum) Get(*auto #empno) Set(*auto #empno)
Define_Pty Name(uFullname) Get(*auto #fullname) Set(*auto #fullname)
End_Com

 

4.  Compile iiiVFW35

5.  Create a new Reusable Part / Object:

     Name: iiiVFW36

     Description: Employee Payload

6.  Define a list collection which collects the employee object, iiiVFW35:

Define_Com Class(#prim_lcol<#iiivfw35>) Name(#Objects)

 

7.  Define a property which passes a reference to the list collection (called #objects) when another component retrieves this property:

Define_Pty Name(pObjects) Get(*collection #Objects)

 

8.  Define a method routine, Add_Item, with input parameters for the employee object properties:

Mthroutine Name(Add_Item)
Define_Map For(*input) Class(#DEPTMENT) Name(#uDeptment)
Define_Map For(*input) Class(#SECTION) Name(#uSection)
Define_Map For(*INPUT) Class(#EMPNO) Name(#uEmployee)
Define_Map For(*INPUT) Class(#FULLNAME) Name(#uFullname)
Endroutine

 

9. Complete the Add_Item method routine.

a.  Add code to define an instance of the employee object iiiVFW35, named New_Object.

b.  Update the properties of New_Object using the passed parameters.

c.  Insert New_Object to the list collection, named Objects.

Mthroutine Name(Add_Item)
Define_Map For(*input) Class(#DEPTMENT) Name(#uDeptment)
Define_Map For(*input) Class(#SECTION) Name(#uSection)
Define_Map For(*INPUT) Class(#EMPNO) Name(#uEmployee)
Define_Map For(*INPUT) Class(#FULLNAME) Name(#uFullname)
Define_Com Class(#iiivfw35) Name(#New_Object)
#New_Object.uDepartment := #uDeptment
#New_Object.usection := #uSection
#New_Object.UEmpNum := #uEmployee
#New_Object.UFullname := #uFullname
#Objects.Insert( #New_Object )
Endroutine

 

10. Compile iiiVFW36.