version 2004
SET FIELD RELATION (manyTable | manyField; one; many)
Parameter | Type | Description | |
manyTable | manyField | Table | Field | Starting table of relations or | |
Starting field of a relation | |||
one | Longint | Status of the Many-to-One relation starting from | |
the field or the Many-to-One relations of the | |||
table | |||
many | Longint | Status 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 one and many parameters return 0, 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 "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 4th Dimension, 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.