Type
Relational Operator

Purpose
The named operator is used to give a unique name to each relationship based on different selection criteria so DataEase can distinguish multiple relationships between the same two tables.

Syntax
RELATIONSHIP named "UNIQUE RELATIONSHIP NAME"
[with (selection criteria)]

Usage
During a script, whenever you add or change the selection criteria of a relationship (predefined or ad?hoc), you create a new ad?hoc relationship. If two tables are related by more than one relationship, each of these relationships must be assigned a unique name, either on the Relationships form or by using the named operator in the script, so DataEase can distinguish between them.
A unique relationship name is an arbitrary name. The name you assign to the relationship is analogous to the optional relationship name used on the Relationships form. It can be any name you like as long as no other relationship in the script (or predefined relationship) has the same name. The name is placed in quotes at the time it's first defined; no quotation marks are used if the name appears in subsequent statements.
When you use the named operator to distinguish a relationship and specify its selection criteria, the new criteria are added to any previously defined criteria, including the criteria on which a predefined relationship was based. Thus, if you add new criteria to a relationship and use the named operator to distinguish it, you don't need to restate all of the criteria that defines the original relationship. Once a relationship is assigned a unique name, you can use the new relationship name alone to reference it without restating the criteria.

Example 1
for MEMBERS ;
modify records in RESERVATIONS named "ACTIVE"
with (DATE > 01/01/93)
TOTAL DUE := TOTAL DUE ? Data-entry DISCOUNT .
delete records in RESERVATIONS named "OUTDATED"
with (DATE < 01/01/89) .
end

This script tells DataEase: 1) Process all the MEMBERS records. 2) For each record processed, find all the related RESERVATIONS records. 3) Divide the related RESERVATIONS records into two groups: one group named ACTIVE (dated after January 1st, 1993), and a second group named OUTDATED (dated before January 1st, 1989). 4) Modify the records in the ACTIVE relationship by subtracting the DISCOUNT value entered in the Data-entry form from the RESERVATIONS TOTAL DUE. 5) Delete the records in the OUTDATED relationship.
There is a predefined relationship between MEMBERS and RESERVATIONS. During this script, we are creating two different ad?hoc relationships between MEMBERS and RESERVATIONS by adding selection criteria based on the value in the DATE field. The named operator is used to assign a unique relationship name to each group of records so DataEase can distinguish between these two relationships.
DataEase continues to apply the match field criteria specified in the predefined relationship between the MEMBERS and RESERVATIONS (that is, MEMBERS MEMBER ID = RESERVATIONS MEMBER ID), you don't need to respecify this match criteria when each new ad?hoc relationship is named.
Subsequently, as long as the criteria remains unchanged, you can use the relationship name alone without restating the relationship criteria. For example, if after modifying the records in the ACTIVE relationship you want to list the RESERVATION ID and TOTAL DUE of each ACTIVE reservation record, the script would look like this:

Example 2
for MEMBERS ;
modify records in RESERVATIONS named "ACTIVE"
with (DATE > 01/01/93) TOTAL DUE := TOTAL DUE ? Data-entry DISCOUNT .
list records in ACTIVE
RESERVATION ID in order ;
TOTAL DUE .end