Step 4 Display Change Variables

Visual LANSA

Step 4. Display/Change Variables

FRM045 - Using LANSA Debug

In this step you will learn how to display and change the variables in a program as it is executing.

1.  Enter a department code of ADM and click the Fetch button. When the Administration department is displayed, leave the values unchanged and click the Update button. Once again the form will stop at the start of the UPDATE.Click event and display the source in the editor.

2.  Display the Variables tab to see a list of the variables in the function. It will appear something like the following:

3.  When debugging components (forms, reusable parts and WAMs) you need to be aware that many fields are components. Note that DEPTDESC and DEPTMENT are shown as type Component. If you open the context menu (right mouse click) on one of these, you will not be able to change the value:

     Note that on the image above, the Set Value option is not available (grayed out).

     Try right clicking on the ANSWER variable (which is a work field value in the form) and note that you could change this value.

4.  To change the value of DEPTDESC you need to expand the form component iiiMntDept and then expand the component DEPTDESC and select Value as shown:

     Note that the Set Value option is available.

     Notice that the Variables tab uses the form's Identifier to name the component, in this case IIIMNTDE. The form compiled object is a Windows DLL named iiimntde.dll, as shown:

     In a later exercise, this topic will be covered in more detail. In most situations your own code can refer to the form using its Long Name and LANSA accesses the object using it's Identifier.

5.  Select Set Value and the Set Value dialog appears, enter a value of NEW ADMINISTRATION.

     Click OK and note that the new value is shown in the Variables tab.

6.  Press F5 to run the application. The form will be redisplayed. Enter ADM in the department code and click the Fetch button.

     The department record has been updated with the changed value.