The first example links a table of reviews to a table of authors. This is a one-to-one link that can be used to get the name of the lead author (stored in the Authors table) for each review:

use REVIEWS && Open in current work area

use AUTHORS in select( ) order AUTH_ID && Open in next available work area

set relation to LEAD_AUTH into AUTHORS && Link Reviews to Authors

The Reviews table has a Lead_auth field that contains the ID of the lead author for each review. The Authors table identifies each author with an ID field named Auth_id. The Auth_id field is indexed by itself, so the index has the same name.

The following example is a one-to-many link between a customer table and an orders table that shows only those customers that have made orders in the past:

use CUSTOMER

use ORDERS in select( ) order CUST_DATE

set relation to CUST_ID into ORDERS

set filter to found( "ORDERS" )

The Customer table has a Cust_id field that contains the customer ID. The same field is a foreign key in the Orders table. The Cust_date index is an expression index created with:

index on CUST_ID + dtos( ORDER_DATE ) tag CUST_DATE

The SET FILTER command shows only those Customers that have a record in the Orders table.