Step 5. Record the Switch History using the Virtual Clipboard
VFW104 – Simple Keyed Collections
In this step you will record the switch history using the VL Framework's virtual clipboard so that the end-user will be able return to the object that initiated the switch.
To use the virtual clipboard most effectively, you need to devise a standardized naming protocol for items that are posted onto it. In this exercise you will use this standard to store the switch history:
ID1 |
SWITCH_HISTORY |
ID2 |
Target Business Object Name |
ID3 |
Target Command Name |
ID4 |
OBJECT_NAME or COMMAND_NAME |
FromAValue |
<object or command name> |
In effect you will be storing a switch history table on the Framework's clipboard. The first key or ID is the code 'SWITCH_HISTORY' to indicate that all records with this ID are related to switching history.
The ID2 and ID3 contain the business object and command respectively that you are switching to.
ID4 contains where you came from. Therefore you need to add two records to the virtual clipboard:
- one where ID4 equals OBJECT_NAME (the business object)
- and another where ID4 equals COMMAND_NAME (the command).
1. Display the
tab for the command handler (iiiVFW28).2. In the event routine for
add code to add the appropriate records to the switch history. Changes are highlighted in red.Evtroutine Handling(#ImageCollection<>.uuShowEmpDetails) Uempnum(#I_EMPNUM)
#empno := #I_EMPNUM
* Save to clipboard return list
* Returns to Section / Images for parent department
#avframeworkmanager.avsavevalue Withid1(SWITCH_HISTORY) Withid2(EMPLOYEES) Withid3(DETAILS) Withid4(OBJECT_NAME) Fromavalue('_DEPARTMENTS')
#avframeworkmanager.avsavevalue Withid1(SWITCH_HISTORY) Withid2(EMPLOYEES) Withid3(DETAILS) Withid4(COMMAND_NAME) Fromavalue('DETAILS')
* Switch to Employee / Details command handler
#avframeworkmanager.avSwitch To(BUSINESSOBJECT) Named(EMPLOYEES) Execute(DETAILS) Caller(#com_owner) Clearinstancelist(TRUE)
Endroutine
Note: Ensure that and , all use your business object names and command name.
3. Compile the command handler iiiVFW28.