DD Remember allows you or your user 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. 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 tool bars 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
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 sophisticated logic you want.
Remember allows the user to select a value in a DEO and say “remember this”. When the record is cleared this becomes the default value. It lets the data-entry person lock in fixed values (like a date or a project Id) of their own choosing. A Remember interface is part of the DEO classes and also exposed in 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, that says “remember the last value”.
Remember acts like field defaults and is applied the same way with Clear and Clear_All.
A remembered field takes precedence over a default field.
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.
Get | Set Field_RememberedValue integer iField to sRememberedValue
If set, this 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 “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 set 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
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
Set the remember value for the appropriate DD field to this DEO’s current value
Send DDFieldRememberLast
Set 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.
The following menu item classes were created so these options can be selected from menus, toolbars and context menus. In addition, we will change our DEO context menu to support this. The class names should be self-explanatory
Keep in mind that exposing this user interface will allow users to override a programmatically provided default using Field_RememberedValue. To avoid this issue, you can use Field_Defaults or Clear (to default parent table values).
For example, the remember options could be added to your DEO context menu by Use-ing 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