Step 5. Add Table Lookup PJC to Employee Table

In this step, you will add a PJC for the Department Description column in the table iiiEmployees which will be retrieved from the iiiDepartments table. By defining a PJC (Predetermined Join Column) in the table, you can access the Department Description each time the Employee table is accessed without writing extra code to access the Department table. This field will appear as if it is simply part of the Employee table and will be retrieved by the OAM. The lookup will only occur if the PJC is requested in the read.

1.  The table iiiEmployees should be open in the Editor and selected.

2.  Ensure that the Table Columns tab is visible. Notice that no PJCs have been defined.

3.  Select the Access Routes tab to add your new predetermined join fields.

4.  Select the IIITODEPT access route. Use the Add button on the Home ribbon, and select Add PJC from the menu.

5.  Complete the Details tab, by enter the following characteristics:

PJC Column

iiiDeptDescPJC

PJC Type

Lookup

Source Column

iiiDeptDescription 

 

     Use the ellipsis button and Find dialog to select each field.

     Your Details tab will now look like this:

     The value of the iiiDeptDescription from the Department table will now be retrieved and returned to a LANSA program as the field iiiDeptDescPJC in the Employee table.

     Note: Predetermined Join Columns are display only fields.

     Your access route should now appear like this:

6.  Select the Table Columns tab. Your field list should now appear like this:

7.  Select the Select View Style button and change the display to Columns List View to get a different overview of your table:

     Your Table Columns tab will now look like this:

8.  Click the iiiDeptDescPJC field. Notice that it is possible to edit the PJC definition from the Table Columns tab.

9.  Compile the table and close it. Remember you now need to rebuild the OAM. If you click Compile it will use the options selected for the last compile.