Enform Plus Reference Manual

Links and the LINK OPTIONAL Statement Rules
Enform Plus Reference Manual422684-001
C-9
Examples of Valid Links
WHERE employee.regnum <> region.regnum OR
employee.branchnum <> branch.branchnum;
A sketch of these links appears as follows:
employee region
branch
The links in this query are invalid because both region and branch appear on the
right side of more than one LINK OPTIONAL statement. The WHERE clause
establishes three two-directional links between employee, region, and branch.
Although the LINK OPTIONAL statements cancel two of the three two-directional links
(between region and employee and between branch and employee), the link
between region and branch still exists. This link causes both region and branch
to appear more than once on the right side of a LINK OPTIONAL statement.
The following query specifications violate rule 2:
LINK employee TO OPTIONAL order VIA regnum;
LINK employee.empnum TO OPTIONAL order.salesman;
LIST empname, ordernum;
A sketch of these links appears as follows:
employee order
These specifications attempt to optionally link employee to order through two
different linking fields. Even though different linking fields are specified, order still
appears on the right side of two LINK OPTIONAL statements.
Examples of Valid Links
The following examples contain valid links that might appear to be invalid. These
examples also include a sketch of their links. The symbols used for the sketches are the
same as those used for the invalid link examples.
The following query specifications contain a LINK OPTIONAL statement and a WHERE
clause:
LINK employee TO OPTIONAL region VIA regnum;
LIST empname, employee.regnum
WHERE employee.regnum <> region.regnum;