Step 4. Reference Fields

REP001 - Create Fields

Reference Fields: A field inherits these characteristics from its reference field:

•  Type
•  Length and decimal positions
•  Edit mask and word
•  Input and output attributes
•  RDMLX enabled flag
•  Default value
•  Keyboard shift

When the definition of a reference field is changed, the characteristics of all fields that are based on it are changed immediately.

In this step, you will create two fields called iiiSurname and iiiGivenName. These fields will use the reference field feature of the LANSA Repository so that their characteristics are inherited from the shipped STD_NAME field.

1.  On the Repository tab, find the field STD_NAME and Copy it to create a new field iii_Name.

a.  Copy the Rules and Triggers

b.  Do not open the field in the editor.

2.  Create the iiiSurname field using the New button on the File menu. Choose Field from the graphical menu.

a.  In the New field dialog, enter:

Field name

iiiSurname

Description

Surname

Reference Field

III_NAME

Close

Yes

Open in Editor

Do not select.

 

b.  Click the Create button.

     Notice that the field type and length are derived from the reference field.

c.  Save and close the field iiiSurname.

3.  Select the New button from the File menu and choose Field from the graphical menu to create the Given Name field (iiiGivenName).

a.  In the New Field dialog enter the following characteristics:

Field name

iiiGivenName

Description

Given Name

Field type

Packed

Field length

15

 

b.  Do not specify a Reference Field yet.

c.  Select the option to Open in editor.

d.  Select the option to Close so that the dialog will be closed.

e.  Press the Create button.

4.  The iiiGivenName field is created and opened in the Editor.

a.  Click on Reference Field in the Definition tab to open the Details tab.

b.  In the Details tab type in iii_NAME as the Reference Field.

     The iiiGivenName field is now based on the definition of the III_NAME field. Notice, for example, that its field type is now Alpha and its length is set to 25. These characteristics are now inherited from the reference field and cannot be changed.

c.  Review the Rules and Triggers tab.

     Notice that there are no rules. However, if you click on the Add button on the Home ribbon, you will see the Adopt from reference field option.

     Do not adopt any rules at this stage.

d.  Save and close the field.

5.  Open the III_NAME field.

6.  Change the Field length to 20.

7.  Save the III_NAME field definition.

8.  Locate the iiiSurname field on the Repository tab. Right-click on the field and choose the Features option from the context menu.

     The Details tab will be displayed, showing the field's definition:

9.  Change the Field length of III_NAME back to 25.

10. Save and close the III_NAME field.