Having a created a dynamic picklist for Department, it is not unreasonable that a picklist might also be required for Section and subsequently employee.

The code following can be used for Section. As with the previous example, the Load method populates the picklist. However, as Section needs to be linked to Deptment at run time the reusable part also implements iMonitorSubject.

     Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_dc.iDynamicPicklist #Prim_dc.iMonitorSubject)
Mthroutine Name(Load) Options(*redefine)
#Picklist.RemoveAll
Select Fields(*all) From_File(Sectab) With_Key(#Deptment)
#Picklist.Add( #Section #Secdesc )
Endselect
Endroutine
Mthroutine Name(ApplyMonitoredValue) Options(*Redefine)
#Deptment := #MonitorSubject.GetValue
Endroutine
End_Com

The form following makes use of both the Deptment and Section visualizations. A monitor is defined with a source of Deptment and a target of Section. When Deptment changes, the ApplyMonitorValue method in the Section visualization is run. A reference to the source object is received allowing the GetValue method to be called to obtain the value.

Immediately after the ApplyMonitorValue has finished, the Load method will be run.

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(304) Clientwidth(589) Left(277) Top(135) Width(605)
Define_Com Class(#Deptment.VisualPicklist) Name(#Deptment) Displayposition(1) Left(8) Parent(#COM_OWNER) Tabposition(1) Top(8) Width(401)
Define_Com Class(#Section.VisualPicklist) Name(#Section) Displayposition(2) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(32) Width(401)
Define_Com Class(#prim_lm) Name(#DepartmentSection) Source(#Deptment) Target(#Section)
Evtroutine Handling(#Deptment.Changed)