1.   Create a DepartmentSearch method routine based on the following:

     Define a component for your server module xEmployeeDataServer / FindxEmployeeByDepar srvroutine, with name DepartmentSearch

     Assign xEmployeeIdentification to null

     Execute DepartmentSearch asynchronously, exchanging fields xDepartmentCode, xEmployeeIdentification and list xEmployeeList.

     Within a DepartmentSearch.Completed eventroutine

       Execute the LoadEmpList subroutine

     End routine

Your code should look like the following:

     Mthroutine Name(DepartmentSearch)

     Define_Com Class(#iiixEmployeeDataServer.FindxEmployeeByDepar) Name(#DepartmentSearch)
     #xEmployeeIdentification := *Null
     #DepartmentSearch.ExecuteAsync( #xDepartmentCode #xEmployeeIdentification #xEmployeeList )
     Evtroutine Handling(#DepartmentSearch.Completed)
     Execute Subroutine(LoadEmpList)
     Endroutine
     Endroutine

Note: Remember to check the srvroutine logic. It receives department code and employee identification, matching the logical table's keys.

2.  Complete the Button_Search.Click event routine by addling logic to invoke the DepartmentSearch routine.

     Your code should look like the following:

     Evtroutine Handling(#Button_Search.Click)
     Case Of_Field(#std_name)
     When (= 'Surname')
     #com_self.Surnamesearch
     When (= 'Given Name')
     #com_self.GivenNameSearch
     When (= 'Department')
     #com_self.DepartmentSearch
     Endcase
     Endroutine

3.  Compile and test your web page.

   The Department search should now populate the Employees list for the selected Department. Not all departments have employees.

  • No labels