Click or drag to resize

Relation Function

Returns a specified relational expression for a table that is open in a specific work area.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
 FUNCTION Relation(
Request Example View Source


nRelationNumber (Optional)
Type: Usual
Specifies which relation is returned. For example, if nRelationNumber is 3, RELATION( ) returns the relational expression for the third relation created.
uArea (Optional)
Type: Usual
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.
Specifies the table alias for a table open in another work area.

Return Value

Type: String
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.
 1Close Databases
 2Open Database (HOME(2) + 'Data\testdata')
 3Use customer IN 0 Order cust_id  // Opens Customer table
 4Use employee IN 0 Order emp_id  // Opens Customer table
 5Use orders IN  0 Order order_id  // Opens Customer table
 6Select orders
 7Set RELATION TO emp_id Into employee
 8Set RELATION TO cust_id Into customer ADDITIVE
 9? RELATION(1)  // Displays CUST_ID
10? RELATION(2)  // Displays EMP_ID
11? RELATION(3)  // Displays empty string
See Also