In this step you will create a hidden filter that loads the Departments to the instance list when you select the Departments business object in the navigation pane. With a hidden filter there is no end-user interaction and the filter is not visible.
1. Display the Visual LANSA Editor.
2. Create a reusable part. Specify iiiCOM08 as the name of your filter and Departments Hidden Filter as the description. (iii are your initials. If you are using an unlicensed or trial version of Visual LANSA, your component names must be in the form DEMCOMnn).
3. In the Details tab specify VF_AC007 as the Ancestor of the reusable part.
4. Display the Source tab.
5. Create a uInitialize routine after the BEGIN_COM statement:
Mthroutine Name(uInitialize) Options(*Redefine)
Endroutine
The Endroutine statement may be created automatically if you have the AutoComplete Prompter turned on.
6. In the uInitialize routine make the filter hidden so that all that will show at run-time is the instance list:
Set #Com_Owner avHiddenFilter(TRUE)
7. Then indicate that the instance list updating is about to start and clear the instance list:
Invoke #avListManager.BeginListUpdate
Invoke #avListManager.ClearList
8. Read all the departments and add them to the instance list:
Select Fields(#xDepartmentCode #xDepartmentDescription) From_File(xDepartments)
Invoke Method(#avListManager.AddtoList) Visualid1(#xDepartmentDescription) Visualid2(#xDepartmentCode) Akey1(#xDepartmentCode) Ncolumn1(0) Acolumn1('') Acolumn2('') Acolumn3('') Acolumn4('') Acolumn5('') Acolumn6('') Acolumn7('')
Endselect
Note: It is necessary to initialize the additional columns with the AddToList, as you will later populate the list with entries for Employees, which will fill these columns.
9. Lastly indicate that instance list updating is now complete:
Invoke #avListManager.EndListUpdate
Your code will look like this:
10. Compile the filter.
11. Display the Framework and then the Properties of the Departments object.
12. Display the Filter / Filter Snap-in Settings tab.
13. Specify the Identifier of iiiCOM08 as the VLF-WIN Component Identifier.
14. Close the Departments' properties.
15. Click on the Employees business object and then Departments again so that the hidden filter loads the departments to the instance list.
16. Expand a Department. Notice that no employees are loaded. You will create the relationship handler that loads the employees in the next step.