Hi DAW,
One of the best features of the NEW DD is the pbUseDDRelates property, but I feel it needs to have a tri-state mode (True, False, Mixed)
We have found that there are times, more than a few, that we need to use pbUseDDRelates in conjunction with the current table/field relationships. Meaning, we want to "add" a DD_Relate to the existing FIELD_Relates, not replace it.
Currently to achieve this, one has to set pbUseDDRelates=True and then manually re-Set all the existing Field_Relates and then add DD_relates. That's fine, but that a lot of maintenance especially if the relates change in the future.
As an interim workaround, we have created a DD property called pbUseDDMixRelates which works but it would be better if this functionality is supported natively in the DD class.
Code:
Procedure AddTableRelationships
Integer iColumn iFields iMain
Integer iRelFile iRelField
Boolean bUseDDRelates
Get pbUseDDRelates to bUseDDRelates
If (bUseDDRelates) Begin
Get Main_File to iMain
Get Field_Count to iFields
For iColumn from 0 to iFields
Get_Attribute DF_FIELD_RELATED_FILE of iMain iColumn to iRelFile
If (iRelFile) Begin
Get_Attribute DF_FIELD_RELATED_FIELD of iMain iColumn to iRelField
Set Field_Related_FileField iColumn to iRelFile iRelField
// Showln "Field_Related_FileField " iMain "," iColumn " -> " iRelFile "," iRelField
End
Loop
End
End_Procedure
{MethodType=Property}
Procedure Set pbUseDDMixRelates Boolean bState
Set pbUseDDRelates to bState
If (bState) Send AddTableRelationships
End_Procedure