RELATE ONE SELECTION

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 6.0 (Modified)


RELATE ONE SELECTION (manyTable; oneTable)

ParameterTypeDescription
manyTableTableMany table name (from which the relation starts)
oneTableTableOne table name (to which the relation refers)

Description

The RELATE ONE SELECTION command creates a new selection of records for the table oneTable, based on the selection of records in the table manyTable and loads the first record of the new selection as the current record.

This command can only be used if there is a relation from manyTable to oneTable. RELATE ONE SELECTION can work across several levels of relations. There can be several related tables between manyTable and oneTable. The relations can be manual or automatic.

Example

The following example finds all the clients whose invoices are due today.

Here is one way of creating a selection in the [Customers] table, given a selection of records in the [Invoices] table:

   CREATE EMPTY SET([Customers];"Payment Due")
   QUERY([Invoices];[Invoices]DueDate = Current date)
   While(Not(End selection([Invoices])))
      RELATE ONE ([Invoices]CustID)
      ADD TO SET([Customers];"Payment Due")
      NEXT RECORD([Invoices])
   End while

The following technique uses RELATE ONE SELECTION to accomplish the same result:

   QUERY([Invoices];[Invoices]DueDate = Current date)
   RELATE ONE SELECTION([Invoices];[Customers])

See Also

QUERY, RELATE MANY SELECTION, RELATE ONE, Sets.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next