RELATION( ) Function
Returns a specified relational expression for a table that is open in a specific work area.
RELATION(nRelationNumber [, nWorkArea | cTableAlias])
Parameters
nRelationNumber
Specifies which relation is returned. For example, if nRelationNumber is 3, RELATION( ) returns the relational expression for the third relation created.nWorkArea
Specifies the work area for a table open in another work area. If a table is not open in the specified work area, RELATION( ) returns an empty string.cTableAlias
Specifies the table alias for a table open in another work area.
Return Value
Character
Remarks
By default, RELATION( ) returns relational expressions for a specified table. If you do not specify a work area or alias, RELATION( ) returns relational expressions for the table in the currently selected work area. If no relations exist, it returns an empty string. For additional information about creating relations between tables, see SET RELATION.
DISPLAY STATUS and LIST STATUS display relational expressions. Issue MODIFY DATABASE to display the Database Designer. This enables you to view and modify relations between tables in the current open database. Issue SET to display the Data Session window. This enables you to view and modify relations between free tables.
Example
In the following example, you open the tables and set the orders. Then, you use RELATION( ) to display the relations.
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer IN 0 ORDER cust_id && Opens Customer table
USE employee IN 0 ORDER emp_id && Opens Customer table
USE orders IN 0 ORDER order_id && Opens Customer table
SELECT orders
SET RELATION TO emp_id INTO employee
SET RELATION TO cust_id INTO customer ADDITIVE
? RELATION(1) && Displays CUST_ID
? RELATION(2) && Displays EMP_ID
? RELATION(3) && Displays empty string