In this step you will write the code for your mini filter. You will need to manually code the filter because there is no Program Coding Assistant for mini filters.
1. Display the Source tab of your filter.
2. Add this statement after the component definitions:
Def_List Name(#Save_Keys) Fields(#xEmployeeSurname) Type(*Working) Entrys(1)
The Save_Keys working list will be used to save the key values from overwrites done by the select loop.
3. Next add a uInitialize method routine.
Mthroutine Name(uInitialize) Options(*Redefine)
#COM_OWNER.avMiniFilter := true
#COM_OWNER.avMiniFilterpanel <= #PANEL1
Endroutine
Your code will now look like this:
4. Next add an event routine to handle the KeyPress event of the xEmployeeSurname field. This event will execute when the Enter key is pressed.
Evtroutine Handling(#xEmployeeSurname.KeyPress) Options(*NOCLEARERRORS *NOCLEARMESSAGES) Keycode(#keycode)
If ('#keycode.value = Enter')
Endif
Endroutine
5. If the Enter key is pressed, save the current key values from overwrites done by the select loop:
Inz_List #Save_Keys 1
6. Indicate that the instance list updating is about to start and then clear the instance list if the checkbox has been selected:
Invoke #avListManager.BeginListUpdate
If '#Clear_List.ButtonState = Checked'
Invoke #avListManager.ClearList
Endif
7. Then select employees that match the search criteria and set up the visual identifiers, then add the entries to the instance list:
Select Fields(#xEmployeeIdentification #xEmployeeSurname) From_File(XEMPLOYEE2) With_Key(#xEmployeeSurname) Nbr_Keys(*Compute) Generic(*yes)
Invoke Method(#avListManager.AddtoList) Visualid1(#xEmployeeIdentification) Visualid2(#xEmployeeSurname) Akey1(#xEmployeeIdentification)
Endselect
8. Lastly indicate that the instance list update is complete and restore the saved key values:
Invoke #avListManager.EndListUpdate
Get_Entry 1 #Save_Keys
Your finished event routine will look like this:
5. Compile the filter.