Step 1 Create Your Real By Name Filter

VLF Windows Application Development

Step 1. Create Your Real By Name Filter

VFW040 – Snap in Real Filters

In this step you will create a real filter (a Reusable Part) which search the file PSLMST by surname, and populate the Instance List. You will learn how to use the Program Coding Assistant.

1.  In the Framework, select the Employees business object and click the Program Coding Assistant button on the By Name filter.

     You could also access the Program Coding Assistant from the Framework menu.

     The Program Coding Assistant allows you to create different types of component which can be plugged into your filters, instance lists and command handlers.

     Initially you will probably select filters which generate a complete component (for example, Filter which searches by all logical views of a file). As you become more expert, you might use a skeleton filter, or copy from one which is similar to what you need and complete the code manually.

2.  If you are using a non-English system, click on Framework-><Your Framework Description> which is the first entry in the Coding Assistant's tree view. In the Select the type of code you want to generate panel, select Set LANSA Code generation preferences. Click the Next button to set your coding preferences.

3.  In the tree view select iii HR Application / Employees / Filter->By Name.

4.  If your Framework is enabled for Web development, Select Windows as the target platform.

5.  In the list headed Select the type of code you want to generate, select Filter that searches using a file or view.

6.  Click the Next button. The coding assistant is a wizard which will present a series of panels which you will complete to generate the filter code required. There may be optional sections on these panels which you will complete as necessary to generate the logic required.

7.  On the first panel enter PSLMST as the physical file name that most closely resembles the business object is.

     Based on the file key and first two fields on the file, the coding assistant suggests the fields required to define the Visual and Programmatic Identifiers.

  • A Visual Identifier is the field or fields that a user would use to identify a unique instance of an object
  • A Programmatic Identifier is the field(s) that the program would use to identify a unique instance of the business object. Typically these would be the primary keys of the file or files that make up the data in the instance list.
  • The additional columns should be completed, if necessary, to correspond to any additional columns which you have added to your instance list, during the prototyping phase.

     In this case, the generated code will use EMPNO and FULLNAME (based on SURNAME plus GIVENAME) to define the visual identifiers.

     EMPNO defines the programmatic identifier

8.  Click the Next button.

9.  On the next panel, select PSLMST2 as view to be used for filtering /searching operations.

10. Select SURNAME as the key(s) of the selected view, to be used for search operations. SURNAME will be the input field on the filter panel.

     Select the following options:

  • Allow generic searching
  • Remember key values between filter executions
  • Allow the user to clear the instance list

11. Click the Next button. Select the check box Routine to listen for signals to update the instance list.

12. Click the Generate Code button.

     The generated code will be displayed.

     You now simply need to create the component by specifying its Name and Description and clicking the Create button. VLF code assistant, currently limits reusable part names to 9 characters.

13. Specify iiiVFW04 as the filter name, where iii are your initials, and Employee By Name Filter as the description. If you are using an unlicenced or trial version of Visual LANSA your component names must be of the form DEMCOM05. Click the Create button.

     When you click the Create button, a reusable part will be created in the Repository and the code will be copied into the editor.

     After a brief delay, a message Created in the development environment will be displayed.

14. Switch to Visual LANSA and compile the reusable part.