pbSmartRelate - BaseData_Set

Controls whether DataDictionaries perform relates on parent tables that are not connected to the DDO structure

Type: Property

Access: Read/Write

Data Type: Boolean

Parameters: None

 Property Boolean pbSmartRelate

Read Access: Get pbSmartRelate to BooleanVariable
Write Access: Set pbSmartRelate to BooleanVariable/Value


pbSmartRelate controls whether DataDictionaries perform relates on parent tables that are not connected to the DDO (DataDictionary Object) structure.

Normally, a DDO structure should be complete and contain all parents. When saving data, this is a requirement. For batch and reporting processing, you may remove parent DDOs if they are not needed for the process. If pbSmartRelate is set true, these non-connected parent records will not be found as part of the relate. This can result in noticeable performance improvements when finding many records (e.g., batch processes or grids that load many records). This will be even more noticeable when using SQL back-ends.

When False, DDOs perform relates on all open parent tables up the ancestor tree. A parent record is found (related) even if there is no parent DDO associated with it. Until version 18.2, this was standard behavior.

The default is True in the DataDictionary class.

The default is False in the abstract DataSet class.

Compatibility Notes about pbSmartRelate

The pbSmartRelate property was introduced in DataFlex 18.2. Prior to this version a DDO find was followed by a relate that would read in all related parents, even if the parent was not part of the DDO structure. You can maintain this legacy behavior by setting pbSmartRelate to False. Almost all developers were not aware of this global relate behavior and naturally assumed that a related find would not occur on parent tables that were not in the DDO structure. Therefore smart-relates (pbSmartRelate = True) probably now works the way you expected it always did.

The default for pbSmartRelate is True. While we normally err on the side of maintaining backwards compatibility, we felt that this behavior change was best choice. Our reasoning was as follows:

- Smart-relates means fewer finds which can be significant, especially in SQL. If we don't make this the default, you will have to actually set this to gain the benefits of this feature - it's too easy to overlook a new property.

- The value of pbSmartRelate should never be an issue with edits, saves or deletes. If a DDO structure is incomplete, you will not be allowed to make changes anyway. Therefore smart-relates and any potential legacy issues only come into play when you are querying data.

- This is the already the behavior that most developers expect and develop around. We felt it was unlikely that developers were counting on the old behavior and that any behavior difference would be accidental.

When migrating up to DataFlex 18.2, our advice is as follows:

1. If you actually knew that DDO relates were unconditional and you wrote code that counted on this behavior, change the default of pbSmartRelate to False. We assume you are using your own DD class layer and you can set the property to False in your sub-class. As time permits, study your code and make the required changes so you can take full advantage of smart relates.

2. If you have any concerns that you may be accidentally relying on the legacy behavior, set pbSmartRelate to False in your sub-class. Keep in mind that this accidental behavior can only matter when querying data.

3. Otherwise keep pbSmartRelate set to True and take advantage of the increased performance with no required programming changes.