Step 1. Create Reusable Part

1.   From the File menu create a New / Reusable Part / Object for the Windows Platform.

      Name: DepartmentPicklist

      Description: Dynamic Picklist for Departments

2.   Replace its source with the following to define the dynamic picklist component:

Function Options(*DIRECT)

Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_dc.iDynamicPicklist)

Mthroutine Name(Load) Options(*redefine)

#Picklist.RemoveAll

Select Fields(*all) From_File(xDepartments)

#Picklist.Add( #xDepartmentCode #xDepartmentDescription )

Endselect

Endroutine

End_Com

 

      This Visual Host component populates the dynamic picklist component (referenced as Picklist in the code) with all records from table xDepartments.

3.   Compile the reusable part.