Versions Compared

Key

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

...

  1. Open the Employees’ Details command handler iiiCOM06.
  2. Display the Design tab.
  3. In the Repository tab, locate Weblets, then the ub_pushb1 weblet.



  4. Drag and drop the ub_pushb1 weblet next to the Save button in the command handler.



  5. Display the Source tab.
  6. Add this code before the UHandleEvent webroutine to set the caption of the button to Back:
    Override      Override Field(#UB_PUSHB1) Default('Back')
    Web     Web_Map For(*both) Fields(#UB_PUSHB1)
  7. In the UHandleEvent register the Back button Click event:
    Invoke      Invoke Method(#avFrameworkManager.avRegisterEvent) Named(UB_PUSHB1.CLICK) Signalaswamevent(2)

    The UHandleEvent will now look like this:

    Image Modified


  8. Next scroll to the end of the WAM source and add an event routine to handle the Back button Click event:
    Evtroutine Handling(#avFrameworkManager.uWAMEvent_2) Options(*noclearmessages *noclearerrors)
    Endroutine
  9. In this routine add this code so that when the users click on the button, they will be switched back to the business object from which they came:
    define

         define field(#ff_objnme)

    TYPE(*CHAR)

    LENGTH(32)

    DESC('Object

    Name')

    define

         define field(#ff_cmdnme)

    TYPE(*CHAR)

    LENGTH(32)

    DESC('Command

    Name')

    #avframeworkmanager


         #avframeworkmanager.avrestorevalue

    WithID1(SWITCH_HISTORY)

    WithID2(OBJECT_NAME)

    ToAValue(#ff_objnme)

    #avframeworkmanager

         #avframeworkmanager.avrestorevalue

    WithID1(SWITCH_HISTORY)

    WithID2(COMMAND_NAME)

    ToAValue(#ff_cmdnme)

    #avframeworkmanager.avSwitch

    To(BUSINESSOBJECT)

    NAMED(#ff_objnme)

    EXECUTE(#ff_cmdnme)

    Caller(#com_owner)

    • When you want to send the user back to the component from which the switch occurred, you need to look at the switch history on the virtual clipboard.  Remember that you need to retrieve both the business object and the command to which you need to return.  That requires retrieving two values from the virtual clipboard.
    • The code first retrieves the OBJECT_NAME or business object value and then the COMMAND_NAME or command value. 
    • When you have these two values you can perform another switch to return to the previous component.

     Your code should look like this:



  10. Compile the command handler and check it in.

    You are now ready to test the switch history:

  11. In the Framework select a section from the Department Sections business object.
  12. Display the details of the section's employees by clicking on the Details button.
  13. On the Details command handler of the Employees business object click on the Back button to return to the Sections business object.

    Image Modified

  14. Close the application.