| 4D v18GET FIELD RELATION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D v18
 GET FIELD RELATION 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GET FIELD RELATION ( manyField ; one ; many {; *} ) | ||||||||
| Parameter | Type | Description | ||||||
| manyField | Field |   | Starting field of a relation | |||||
| one | Longint |   | Status of the Many-to-One relation | |||||
| many | Longint |   | Status of the One-to-Many relation | |||||
| * | Operator |   | • If passed: one and many return the current status of the relation (values 2 or 3 only) • If omitted (default): one and many can return the value 1 if the relation has not been modified through programming | |||||
The GET FIELD RELATION command lets you find out the automatic/manual status of the relation starting from manyField for the current process. You can view any relation, including automatic relations set in the Structure window.
You can compare the values returned in the one and many parameters with the constants of the “Relations” theme:
| Constant | Type | Value | 
| Automatic | Longint | 3 | 
| Manual | Longint | 2 | 
| No relation | Longint | 0 | 
| Structure configuration | Longint | 1 | 
Given the following structure:

The properties of the relation linking the [Employees]Company field to the [Companies]Name field are the following:

The following code illustrates the various possibilities offered by the GET FIELD RELATION, GET AUTOMATIC RELATIONS and SET FIELD RELATION, SET AUTOMATIC RELATIONS commands along with their effects:
 GET AUTOMATIC RELATIONS(one;many) `returns False, False
 GET FIELD RELATION([Employees]Company;one;many) `returns 1,1
 GET FIELD RELATION([Employees]Company;one;many;*) `returns 3,2
 
 SET FIELD RELATION([Employees]Company;2;0) `changes Many-to-One relation to manual
 
 GET FIELD RELATION([Employees]Company;one;many) `returns 2,1
 GET FIELD RELATION([Employees]Company;one;many;*) `returns 2, 2
 
 SET FIELD RELATION([Employees]Company;1;0) `re-establishes the parameters set in Design environment for Many-to-One relation
 
 GET FIELD RELATION([Employees]Company;one;many) `returns 1,1
 GET FIELD RELATION([Employees]Company;one;many;*) `returns 3,2
 
 SET AUTOMATIC RELATIONS(True;True) `changes all relations of all tables to automatic
 
 GET AUTOMATIC RELATIONS(one;many) `returns True, True
 GET FIELD RELATION([Employees]Company;one;many) `returns 1,1
 GET FIELD RELATION([Employees]Company;one;many;*) `returns 3,3
									GET AUTOMATIC RELATIONS
									
									GET RELATION PROPERTIES
									
									SET AUTOMATIC RELATIONS
									
									SET FIELD RELATION
									
	Product:  4D
	Theme:  Relations
	Number:  
        920
        
        
        
	
	Created:  4D 2004
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D Language Reference ( 4D v18)
	
	
	
	
	
 Add a comment
Add a comment