JavaScript Editor js editor     Web development 



Main Page

Returns a specified relational expression for a table 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 isn't open in the work area you specify, RELATION(В ) returns the empty string.
cTableAlias


Specifies the table alias for a table open in another work area.

Return Value

Character

Remarks

RELATION(В ) by default returns relational expressions for the table in the currently selected work area. It returns the empty string if no relations exist. 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, allowing you to view and modify relations between tables in the current open database. Issue SET to display the Data Session window, allowing you to view and modify relations between free tables.

Example

In the following example, tables are opened and orders set, and then the relations are displayed using RELATION(В ).

В Copy Code
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

See Also



JavaScript Editor js editor     Web development 
R7