Step 2 Create Department Test Form

Visual LANSA

Step 2. Create Department Test Form

REP006 - Logical Views

In this step you will create a form that searches the Department file by the department description. You can do this because the logical view you just created is keyed by the department description.

1.  Create a  form with the following characteristics:

Name

iiiSearchDeptByDesc   (where iii=your initials)

Description

Search by Department Description

RDMLX Enabled

Select

 

2.  Next add the fields iiiDeptCode and the iiiDeptDescription to your form:

a.  Once the new form has opened in the Editor,, display the iiiLIST tab.

b.   Drag and drop the iiiDeptCode and iiiDeptDescription fields onto the form:

3.  Next add a button to the form:

a.  Locate the Controls tab. If this tab is not open, open it from the Home ribbon, Views menu.

b.  On the Controls tab select the Push button control and drag and drop it onto the form:

c.  Double-click the button on the form to display the Details tab. The Details tab is showing the Properties, Events and Methods for the Push Button.

d.  In the Caption property enter Find Department Code.

e.  Adjust the width of the push button to display the Caption.

f.  Adjust the height and width of the form.

4.  Next add some code that will search the logical view and return the department code based on the department description:

a.  Select the Events tab on the Details tab. Double click on the Click event to create a Click event routine for the push button. Your code will look like the following:

b.  Select the Source tab. Your code will look like the following:

EVTROUTINE HANDLING(#PHBN_1.Click)

ENDROUTINE.

 

c.  Complete the push button click event routine, by adding a Fetch statement. Your new code should look like the following:

Fetch FIELDS(#iiiDeptcode) from_file(iiiDeptsByDesc) with_key(#iiiDeptDescription)

 

     Your complete source code should now look like this:

5.  To compile your form:

a.  Press the Compile button on the Editor toolbar.

b.  Check that the compile completed successfully.