In this step, you will create a real filter which searches the XEMPLOYEE table by employee surname. You will also learn how to use the Program Coding Assistant.
Note that the instance list used in this tutorial shows the Employee Number and Surname fields. Please make sure the definition of your Employee business object matches this (you can delete the Employee Given Name column in the Instance List tab of the properties of Employee.)
1. Click on the Program Coding Assistant button in the By Name filter.
The Program Coding Assistant window is displayed. It allows you to create different types of components that can be plugged into your filters, instance lists and command handlers. It is highly recommended to use the assistant when you first start using the Framework.
Initially you will most likely use filters that generate a component that can be executed (e.g. CRUD Filter (Create/Read/Update/Delete) or a Filter and Instance List). As you progress you might only use a skeleton filter or simply copy from one that is similar to one that you want to create.
2. If you are using a non-English system, click on Framework -> Tutorial Framework in the top-left tree view. The Set LANSA code generation preferences option appears at the bottom. Select this option and set your preferences.
3. In the list on the top left, select the iiiHR application and then the By Name filter.
4. As the type of code you want to generate, select Filter and Instance List.
5. Click the Next button.
6. On the next page specify XEMPLOYEE as The physical file that most closely resembles this business object.
Next specify the fields to be shown in the instance list, and the field that identifies the records:
7. Drag the XEMPLOYID, XSURNAME and XGIVENAME fields to the list of fields to be shown in the instance list.
8. Drag the XEMPLOYID field to the list of identifier fields.
19. Click the Next button.
10. On the next page specify XEMPLOYEE2 as the view to be used for filtering/searching operations. It is logical view of the XEMPLOYEE table keyed by the XSURNAME and XGIVENAME fields.
Note that you need an appropriate index for each filter that you want to create. Before implementing all your filters, review your data model to confirm that all the indexes exist. Doing so will speed up the process of implementing your prototype.
11. Select the XSURNAME field as the key of the view to be used for search operations,and make sure the Allow Generic Searching option is selected.
12. Click the Next button. Ignore the options on this page.
13. Click the Generate Code button.
The next page, Generated Code, displays the source code for your filter. You now need to create the component that will contain this code:
14. Specify iiiCOM01 as the name of your real filter and By Name 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 of the form DEMCOMnn).
15. Select the Snap In option to automatically compile and snap the filter in the Framework, and click on the Create button to create the component.
After a brief delay you will see a message indicating that the filter has been compiled and snapped into the Framework.
16. Close the Program Coding Assistant.