SET FIELD RELATION

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 2004


SET FIELD RELATION (manyTable | manyField; one; many)

ParameterTypeDescription
manyTable | manyFieldTable | FieldStarting table of relations or
Starting field of a relation
oneLongintStatus of the Many-to-One relation starting from
the field or the Many-to-One relations of the
table
manyLongintStatus of the One-to-Many relation starting from
the field or the One-to-Many relations of the
table

Description

The SET FIELD RELATION command lets you set the automatic/manual status of each relation of the database separately for the current process, regardless of its initial status as defined in the Relation properties window in the Design environment.

In the first parameter, pass a table or field name:

If you pass a field name (manyField), the command will only apply to the relation starting from the specified Many field.

If you pass a table name (manyTable), the command will apply to all the relations starting from the specified Many table.

If there is no relation starting from the manyField field or manyTable table, the syntax error No. 16 ("The field has no relation") is generated and the system variable OK is set to 0.

In the one and many parameters, pass the values indicating the changing of the automatic/manual status to be applied respectively to the specified Many-to-One and One-to-Many relation(s). You can use the constants of the "About Relations" theme:

Do not modify (0) = Do not modify the current status of the relation(s).

Structure configuration (1) = Use the configuration set for the relation(s) in the Structure window of the application.

Manual (2) = Makes the relation(s) manual for the current process.

Automatic (3) = Makes the relation(s) automatic for the current process.

Note: Changes made using this command only apply to the current process. The configuration of the relations set using the options in the Relation properties window is not modified.

Example

This command makes the management of relations easier in the Quick Report editor. In previous versions of 4D, it was necessary to set all relations as automatic to use them in the editor. Now, the following code allows setting only useful relations as automatic:

   SET AUTOMATIC RELATIONS(False;False) `Reset of the relations
      `Only the following relations will be used
   SET FIELD RELATION([Invoices]Cust_IDt;Automatic;Automatic)
   SET FIELD RELATION([Invoice_Row]Invoice_ID;Automatic;Automatic)
   QR REPORT([Invoices];Char(1);True;True;True)

See Also

GET AUTOMATIC RELATIONS, GET FIELD RELATION, GET RELATION PROPERTIES, SET AUTOMATIC RELATIONS.


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