DDO Propagation and Relates-to Constraints

The relates-to constraint is used constrain child records to a record in a parent table. Relates-to constraints change the way DDOs interact with each other. When a relate-to constraint exists, the DDO find and clear behaviors will change to operate properly within in a constrained parent-child environment. This requires that:

  1. When constrained child record is found, only records that are related to the parent will be allowed.

  2. When a constraining parent changes via a Find or Clear its record, the constrained child DDO, will be notified of the change. That child must make adhere to the constraint by either making sure that the child is within the constraint or it is cleared.

 

These two rules require that the propagation rules for clear and find change when a relates-to constraints is in place.

The next two samples will show the same DDO structure except that one will not have a relates-to constraints and the other will.

DDO Propagation without a Relates-to Constraint   

We have a Data Dictionary structure with no relates-to constraints as shown in the diagram. Our DEOs could connect to any of these objects. For example, if our DEO were using DDO D, all of the DEO’s data-file requests (save, clear, delete, find) will be handled by DDO D.

A   B   C

 \ /   /

  D   E

   \ /

    F

 
Clear All
Clear
Save
Delete (Cascade_Delete_State is true in all DDOs.)
Find
 

DDO Propagation with a Relates-to Constraint

We will give our Data Dictionary structure the following values:

A   B   C         A = Customer

 \ /   /          B = Terms

  D   E           C = Vendor

  c\ /            D = Order Header

    F             E = Inventory

                  F = Order Detail


  1. F has a relates-to constraint to D (set Constrain_File to D.File_Number).

  2. DEO_Header_Entry uses D as its DDO server (set server to D).

  3. DEO_Table_Entry uses F as its DDO server (set server to F).

 

We now have a standard order-file structure. We will hook two types of DEOs to this structure: a set of order-header-entry DEOs using D as its server and an order-detail grid using F as its server. This means that users will only be sending Data Dictionary requests to DDOs D and F. Without a relates to constraint between F and D, the data-entry behaviors will not be appropriate for our entry-form/grid setup. The save and delete behaviors are fine; the clear and find behaviors are not.

We must add a relates-to constraint in DDO F which will constrain F records at any given moment to only those relating to the current record of its Parent table D. Constraints have no impact on saving or deleting (which is good). They do change the clear and find behaviors (which is also good).

Clear
Find

The header object will contain the fields allowing us to find the customer records (A). We did not choose to constrain the order header table to the customer table. For finding purposes, we do not want our search of orders to be limited to a single Customer. We did not create a separate DEO for the Customer fields. If we had done this (and that DEO was using the Customer DDO), we would have gotten undesired save and delete behaviors. Save would have only saved the Customer table. Deletes would have deleted the customer record and all of its children.

See Also

Propagation of DDO Operations