This section discusses relationship attributes other than identifying attributes (Parent Table, Child Table, Role, Parent Column, Child Column) and attributes that are merely textual (Co-Role, Lookup Window Name, Related Window Name).
The attributes discussed may be set by clicking the Relationship Details tab in the Relationship window.
This relationship attribute is intended only for dealing with exceptional cases that are not typically good design.
By default, Foreign Key Mandatory = Yes if all the foreign key columns in the relationship have Mandatory = Yes. Otherwise, by default, Foreign Key Mandatory = No.
As a rule, you should not tamper with this default.
If Foreign Key Mandatory = Yes, in each child record, each Child Column of the relationship must have a value other than NULL. This is often expressed by saying that "the relationship is mandatory". While it's important to decide, for each relationship separately, if you want it to be mandatory or not, you should generally express this decision by setting Mandatory = Yes or Mandatory = No at Column level (= when defining the foreign key), not by setting Foreign Key Mandatory.
When you are in the Relationships window, the Foreign Key Mandatory checkbox allows you to see at a glance whether the relationship is mandatory or not, but it is not generally the place where you should express this.
Only if Foreign Key Mandatory = No can you use the Check Partial Foreign Key checkbox to express how NULL values in multi-column foreign keys must be treated.
If all the foreign key columns in the relationship have Mandatory = Yes, you cannot change the default Foreign Key Mandatory = Yes.
|
This relationship attribute is intended only for dealing with exceptional cases that are not typically good design.
By default, Check Partial Foreign Key = Yes.
As a rule, you should not tamper with this default.
In relationships where the key spans more than one column, you can specify that partial foreign keys are not to be checked, where "to check" means to validate that the value entered in the foreign key field is an existing value in the corresponding parent column. Partial foreign keys occur when one or more foreign key columns have the NULL value. An exception to this rule is when the parent column on which you set the NULL value is not mandatory (allows NULL values). In this case the NULL value should be checked since it is an allowed value.
If you clear the Check Partial Foreign Key checkbox in the Relationships info window, in partial foreign keys none of the foreign key column values are checked. This is not generally recommended because, as a result, foreign key column values that do not exist in the corresponding primary key column are allowed into the database if one of the other foreign key columns has the NULL value.
Only consider clearing the Check Partial Foreign Key checkbox in special cases such as overlapping foreign key situations, e.g. columns A and B form one foreign key, and columns A and C another. This allows the user to enter child records with values for A and B but not C. These records are checked with regard to the relationship on columns A-B, while the relationship on columns A-C is not checked until a value for column C is provided.
You can only clear this checkbox if you clear the Foreign Key Mandatory checkbox as well.
|
If Lock Foreign Key on Check = Yes (the default), the parent record is locked whilst changes are made to child records.
In some situations this behavior may be undesirable. For example, if there are few parent records but each have many child records, users editing unrelated child records could lock each other out. If the parent table is not subject to many changes, it may be better not to lock the parent. In this case, set Lock Foreign Key = No.
|
Set this attribute to restrict updatability of foreign key values in the relationship.
By default, Foreign Key Updatable = Yes.
As a rule, you should not tamper with this default.
You can restrict the updatability of a column at Column level by setting the Updatable attribute. Cases are very few where you want to restrict updatability specifically at the Relationship level and not at the Column level. But even at the Column level, restricting updatability is often unnecessary and complicates data management operations.
Foreign Key Updatable
|
Yes
|
Users are allowed to change existing values in foreign key columns of the relationship.
|
No
|
Users are not allowed to change existing values in foreign key columns of the relationship.
|
Only If Null
|
Users are allowed to change existing NULL values in foreign key columns of the relationship to non-NULL values. They are not allowed to change non-NULL values.
|
|
If you set Child Must Exist = Yes, for each parent record in the relationship, there must be at least 1 child record that refers to that parent record.
By default, Child Must Exist = No.
Setting Child Must Exist = Yes is equivalent to setting Minimum Children = 1.
|
If you set Minimum Children to an integer value, for each parent record in the relationship, there must be at least this number of child records referring to that parent record.
By default, Minimum Children is empty (NULL).
Setting Minimum Children = 1 is equivalent to setting Child Must Exist = Yes.
|
If you set Maximum Children to an integer value, for each parent record in the relationship, there may be no more than this number of child records referring to that parent record.
By default, Maximum Children is empty (NULL).
|
You can set Lookup Method to control the way that USoft Definer generates default GUI behavior for the relationship in situations where the user attempts to select a foreign key value from the set of available parent values ("lookup" behavior). This behavior may be overridden at GUI level (in the Windows Designer or Web Designer).
Lookup Method
|
Dropdown List
|
Use this option only if there are relatively few (5-20) parent values to choose from. Available parent values are presented in a dropdown list implemented for the foreign key field.
|
Radio
|
Use this option only if there are few (2-5) parent values to choose from.
Available parent values are presented as "radio button" options. The foreign key field is transformed into a radio button group.
|
Lookup Window or Page
|
This is the default option. Use this option if there are more than 20 parent values to choose from. At the foreign key field, a button is implemented that lets the user step out to a lookup form where she can query and select available values.
|
|
You can set Delete Rule to control the behavior of the runtime application if the user attempts to delete a parent record for which corresponding child records exist.
Delete Rule
|
Restricted
|
This is the default option.
When the user attempts to delete a parent record, processing is blocked and an error message is produced if corresponding children exist.
|
Cascading
|
When the user attempts to delete a parent record, any corresponding children are automatically deleted as well.
If the children about to be deleted are themselves parents in a relationship with Delete Rule = Restricted and have corresponding children, the entire operation is blocked and an error message is displayed.
|
Nullify
|
When the user attempts to delete a parent record, foreign key values in any corresponding child records are set to NULL.
This option is only suitable if there are no foreign key columns with Mandatory = Yes and if the relationship has Foreign Key Mandatory = No.
|
|
You can set Update Rule to control the behavior of the runtime application if the user attempts to update a value in the parent column of a record for which corresponding child records exist.
Update Rule
|
Restricted
|
This is the default option.
When the user attempts to update a value in a parent column, processing is blocked and an error message is produced if corresponding children exist.
|
Cascading
|
When the user attempts to update a value in a parent column, the values in de corresponding child column of corresponding child records (if any) is updated accordingly.
|
Nullify
|
When the user attempts to update a value in a parent column, the values in de corresponding child column of corresponding child records (if any) is set to NULL.
This option is only suitable if there are no foreign key columns with Mandatory = Yes and if the relationship has Foreign Key Mandatory = No.
|
|
See Also
Relationships
Good Relationship Design
The RELATE keyword
|