DD Remember
Previous: Pre and Post Find Events
Next: Committed Records and DD_Commit
In 17.0, we are introducing a retain option replacement called DD Remember. DD Remember allows you or your users to dynamically assign and remember a specific value. When you clear a view, this remembered value is used as the new default. You can also choose to remember the last value entered (similar to the old DD_Retain). When you clear a view, the value currently in the DEO will be used as the new default.
This can be assigned at the DD or at the DEO level. Even better, this can be set directly by your end users. Menu items can be added to your menus, context menus, and toolbars to do this. This empowers your users and makes data entry faster and more flexible. No programming is required to support this.
This works differently and properly with parent fields, where you can remember an entire parent record.
DDs support recommended ways to set default values after a clear: Field Default and Field Remember.
Field Default
This uses the standard DD Field_Defaults mechanism and provides a way for the developer to provide any kind of new record default they wish. These defaults are code-based, so you can create any kind of sophisticated logic you want. This feature has always been a part of DDs and is not changing.
Field Remember
Remember is a new concept. It allows the user to select a value in a DEO and say “remember this.” When the record is cleared, this becomes the default value. In many ways, this is far more useful than Retain because it lets the data-entry person lock in fixed values (like a date or a project ID) of their own choosing. A Remember interface has been added to the DEO classes, and it is also exposed in new DEO menus (context menus, file menus, and toolbars). This allows this feature to be used dynamically by the end user.
- A special case of remember is supported, which says “remember the last value,” replacing retain.
- Remember acts like field-defaults and is applied the same with Clear and Clear_All.
- A remembered field takes precedence over a default field.
- The old Retain / Retain_All DD settings have been deprecated but not changed.
Defaults on Parent Records
Special logic is required for remembered values on parent fields. Most of the time, they make no sense because you are going to be finding a parent anyway. Where they do make sense is on a parent’s autofind field. In this case, you are saying that you'd like to remember the entire parent record. Remembered values in autofind fields perform an autofind, providing the entire parent as the default.
DataDictionary Class Changes for DD Remember
Get | Set Field_RememberedValue iField to sRememberedValue
Set Field_RememberedValue Field Customer.Name to "Smith"
If set, Field_RememberedValue specifies that this value should be used as the default.
If sRememberedValue is passed an empty value, the remember value is removed for that field (it "unremembers" or forgets).
If the special value DD_RememberLast is passed, the DD will use the last value (similar to Retain).
Normally, this will be set dynamically and at the object instance level. Therefore, this is not modeled in the DD class modeler. Most often, this will not be set directly but will be done indirectly by sending a DEO message (DDFieldRemember, DDFieldRememberLast, DDFieldUnRemember) or a DD message (ClearRememberedDefaults, ClearAllRememberedDefaults). Often, menus will send these messages.
Send ClearRememberedDefaults
Clears all dynamically assigned defaults for this one DDO.
Send ClearAllRememberedDefaults
Clears all dynamically assigned defaults for all DDOs in this structure.
DEO Class Changes for DD Remember
Normally, you will use a DEO to handle DD remember settings. Note that these messages do not require any parameters, which makes them good candidates for use with accelerator keys and menu items.
Send DDFieldRemember
Sets the remember value for the appropriate DD field to this DEO’s current value.
Send DDFieldRememberLast
Sets the remember value for the appropriate DD field to whatever is in the DEO at the time that it is cleared.
Send DDFieldUnRemember
Clears the remember value for the appropriate DD field.
New Menu Item Classes for DD Remember
The following menu item classes were created so these options can be selected from menus, toolbars, and context menus. In addition, we have changed our DEO context menu to support this. The class names should be self-explanatory.
- cCJRememberFieldMenuItem
- cCJRememberLastFieldMenuItem
- cCJUnRememberFieldMenuItem
- cCJUnRememberFieldAllMenuItem
For example, the remember options could be added to your DEO context menu by using the following file in your application, which is what has been done to the order entry example:
Use Windows.pkg
Use cCJStandardMenuItemClasses.pkg
Use cCJDeoMenuItemClasses.pkg
Object oDEOEditContextMenu17 is a cCJContextMenu
Move Self to Default_dbFloating_Menu_ID
Object oUndoMenuItem is a cCJUndoMenuItem
End_Object
Object oCutMenuItem is a cCJCutMenuItem
Set pbControlBeginGroup to True
End_Object
Object oCopyMenuItem is a cCJCopyMenuItem
End_Object
Object oPasteMenuItem is a cCJPasteMenuItem
End_Object
Object oDeleteItem is a cCJDeleteEditMenuItem
End_Object
Object oSelectAllMenuItem is a cCJSelectAllMenuItem
Set pbControlBeginGroup to True
End_Object
Object oPromptMenuItem is a cCJPromptMenuItem
Set pbControlBeginGroup to True
End_Object
Object oFindNextMenu is a cCJFindNextMenuItem
Set pbControlBeginGroup to True
End_Object
Object oFindPreviousMenu is a cCJFindPreviousMenuItem
End_Object
Object oClearMenuItem is a cCJClearMenuItem
Set pbControlBeginGroup to True
End_Object
Object oClearAllMenu is a cCJClearAllMenuItem
End_Object
Object oSaveMenu is a cCJSaveMenuItem
End_Object
Object oDeleteMenu is a cCJDeleteMenuItem
End_Object
Object oRememberItem is a cCJRememberFieldMenuItem
Set pbControlBeginGroup to True
End_Object
Object oRetainItem is a cCJRememberLastFieldMenuItem
End_Object
Object oUnRememberItem is a cCJUnRememberFieldMenuItem
End_Object
Object oCJClearAllDynamicDefaults is a cCJUnRememberFieldAllMenuItem
End_Object
End_Object
Compatibility Issues
This is a new feature. Therefore, existing programs should work unchanged. The DD_Retain logic has not been changed and will not be changed.
See Also
- Data Dictionary Improvements 17.0