Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a new Employee Enquiry WAM and complete its code by copying the following code.
         Name: iiiEmpEnqToFile
         Description: Employee Enquiry to File
         Layout Template: iiilay01

         Group_By Name(#empgroup) Fields((#SURNAME *OUT) (#GIVENAME *OUT) (#ADDRESS1 *OUT) (#ADDRESS2 *OUT) (#ADDRESS3 *OUT) (#POSTCODE *OUT) (#PHONEHME *OUT) (#PHONEBUS *OUT) (#DEPTMENT *OUT) (#SECTION *OUT) (#SALARY *OUT) (#STARTDTE *OUT) (#TERMDATE *OUT))
    Webroutine Name(begin) Desc('Select Employee')
    Web_Map For(*output) Fields(#empno)
    Endroutine
    Webroutine Name(DETAILS) Desc('Employee Details')
    Web_Map For(*BOTH) Fields((#EMPNO *OUTPUT))
    Web_Map For(*OUTPUT) Fields(#empgroup)
    Fetch Fields(#empgroup) From_File(PSLMST) With_Key(#EMPNO) Val_Error(*NEXT)
    If_Status Is_Not(*OKAY)
    Message Msgtxt('Employee not found')
    Endif
    Endroutine

  2. Add logic to the details WebRoutine to retrieve session value. If non blank, use as employee number.
    Add the following code in WebRoutine Details, immediately before the FETCH command.

         Define Field(#retcode) Type(*char) Length(2)
    Use Builtin(get_session_value) With_Args(UDEF) To_Get(#STD_QSEL #retcode)
    If (#std_qsel *NE *blanks)
    #empno := #std_QSEL.trim
    Endif

  3. Compile your WAM.

  4. Open the begin WebRoutine in the design view.
    1. Add a right hand column to the table containing employee number.
    2. Drag and drop a push button weblet into the new column.
    3. Change the caption to Select.
    4. Set the push button on_click_wrname property to invoke the Details WebRoutine.
    5. The submitExtraFields property does not need to be specified.
    6. Remove the place holder characters.
    7. Save your changes.

  5. Run the begin WebRoutine in the browser and ensure that the details WebRoutine executes normally when invoked from the begin web page. Enter an employee number such as A0090, A0070 or A1001.