4 7 2 PJF Examples

Visual LANSA

4.7.2 PJF Examples

Example 1

To retrieve a customer description to be displayed when processing an order:

  • First an access route is defined from the order file to the customer file. The maximum records retrieved is defined as One and the customer code field from the order file is used as the key.
  • Next a Predetermined Join Field is added to receive the customer description using the LOOKUP operation. The source field name can be used and, if required, a KEEP LAST value entered.

When the I/O module for the order file is made operational the Predetermined Join Field customer description will be available in the same way as a virtual field when coding RDML without having to include any type of fetch from the customer file.

Where a code file is repeatedly accessed for the same information an appropriate KEEP LAST value will reduce the number of I/Os performed.

Example 2

To retrieve the descriptions of the 'from' and 'to' warehouses in a stock transfer file:

  • Two access routes must be defined, as in Example 1, from the transfer file to the warehouse file. The first will use the 'from' warehouse code field as the key and the second will use the 'to' warehouse code field as key.
  • When defining the Predetermined Join Field on the first access route, the source field name can be used; but when defining the Predetermined Join Field on the second access route, a different field name must be used so that both the 'from' and 'to' descriptions are available at the same time.

Example 3

To retrieve the total value and number of lines in an order when displaying the order header details:

  • Define an access route from the order header file to the order line file with the appropriate key. The number of records expected will be the maximum number of lines in an order.
  • Select the access route for Predetermined Join Field definition.
  • From the displayed fields in the order line file, select the line value field. Add the Predetermined Join Field using the TOTAL operation. The count of order lines can also be performed on this field or on any other field in the file.

When the order file is made operational, the total value and line count fields are available in the RDML editor along with the order fields without coding any reference to the order line file.

Example 4

To calculate a price for each line of an order using a Predetermined Join Field and a virtual field:

  • Define an access route from the order line file to the product file with a 1:1 relationship (by settimg the Maximum Records value), a Keep Last value if appropriate, set the Derivation  to "before virtual fields" and use the product code field from the order line file as the key.
  • Define a virtual field of extended definition type "mathematical calculation" to be derived "after input from file". Define the calculation as follows: product quantity (from order line file) multiplied by product price (Predetermined Join Field from product file) equals virtual field.

By including the product price (Predetermined Join Field) and product value (virtual field) when defining a select command in RDML, the arithmetic will be performed without any additional RDML code.

Also See

4.7.1 Predetermined Join Field Concepts

Ý 4.7 Predetermined Join Field Development