Step 4. Complete Command Handler to use Department Dropdown
VFW072 – Create a Department Dropdown Reusable Part
In this step you will add code to the
command handler, to interact with the component.Your command handler is a maintenance function. This means:
1. When the employee data is read, it needs to tell the department dropdown to position to the current employee's department. Change the DEPTMENT.
method routine to set the in the department dropdown component toYour code should look like the following. Changes are shown in red.
. . . .
Fetch Fields(#XG_HEAD) From_File(PSLMST) With_Key(#EMPNO)
* ??? Addition logic may be required here ???
#IIIVFW13.ucurrDepartment := #deptment
2. When the department dropdown component signals that department has changed, the command handler should get the current department code value from the department dropdown.
3. Add an event handling routine for
Your code should look like the following:Evtroutine Handling(#IIIVFW13.UDepartmentChanged)
#deptment := #IIIVFW13.uCurrDepartment
Endroutine
Hint: To create the event handling routine, on the tab, select the department dropdown and use the context menu to select .
4. Compile the Employee Details command handler, iiiVFW06.
5. Execute the
. Use the By Location filter to populate the instance list and check that the department dropdown displays the correct value.6. Change the department for an employee and
the change. You may find that the change is invalid because the section code is no longer valid. You will address this issue in the next exercise.