Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : DEFAULT-VALUE attribute
 

DEFAULT-VALUE attribute

The initial value of a table column in the native data type of the buffer-field.
Data type: The data type of the corresponding buffer-field
Access: Read-only
Applies to: Buffer-field object handle
For a DATE field with an INITIAL value of TODAY, DEFAULT-VALUE would contain a DATE value with today's date. For a DATETIME field with an INITIAL value of NOW, DEFAULT-VALUE would contain a DATETIME value with the current time. For a DECIMAL field, DEFAULT-VALUE would contain a DECIMAL value, as opposed to the INITIAL attribute, which has a CHARACTER data type.
DEFAULT-VALUE is suitable for assignment into a newly created record, but not as the initial value in the ADD-NEW-FIELD( ) method. In this case, TODAY and NOW will be the values and not the special strings for TODAY and NOW. That is, DEFAULT-VALUE for the initial argument in ADD-NEW-FIELD( ) will return INITIAL [today's date], instead of INITIAL TODAY.
In order for ADD-NEW-FIELD( ) to work correctly with an existing buffer for a new temp-table being dynamically built, you can use the ADD-LIKE-FIELD( ) method or, rather than using DEFAULT-VALUE, you can use the DEFAULT-STRING attribute, which is the unformatted, character data type version of the DEFAULT-VALUE including TODAY and NOW.

See also

ADD-LIKE-FIELD( ) method, ADD-NEW-FIELD( ) method, DATE-FORMAT attribute, DEFAULT-STRING attribute, INITIAL attribute, NUMERIC-FORMAT attribute