TARGET( ) Function

Returns the alias of a table that is the target for a relation as specified in the INTO clause of SET RELATION.

TARGET(nRelationshipNumber [, nWorkArea | cTableAlias])

Return Values

Character

Parameters

  • nRelationshipNumber
    Specifies the number of a relationship. Include a number from 1 to the number of relationships out of the specified work area. The aliases of the target tables are returned (in no specific order) until nRelationshipNumber is greater than the number of relationships. When nRelationshipNumber is greater than the number of relationships, the empty string is returned.
  • nWorkArea | cTableAlias
    Returns the alias of the target table in another work area. nWorkArea specifies a work area number and cTableAlias specifies a table alias. By default, the alias of the target table from the current work area is returned if you don't specify the work area or alias.

Example

In the following example, a relation is set on the field order_id from orders into customer. The TARGET( ) function is then used to return the alias of the target table.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE orders IN 0 ORDER order_id
USE customer IN 0 ORDER cust_id
SELECT orders
SET RELATION TO cust_id INTO customer
? TARGET(1)  && Displays customer
? TARGET(2)  && Empty string

See Also

RELATION( ) | SET RELATION | SELECT