6.18 LceGetDefaultValueU
Retrieves the default value of a Unicode field, if it has been defined in the Repository. The retrieved default is fully evaluated. For example, if the field is the current date, the actual current date will be retrieved.
BOOL |
LceGetDefaultValueX |
(int |
iSession, |
|
|
char far * |
strFieldName, |
|
|
wchar_t far |
strValue, |
|
|
int |
iValueSize, |
|
|
unsigned long far * |
pulFlags ) |
Parameters
iSession |
The session identifier as returned by LceGetSessionId. |
strFieldName |
The field name of a field previously declared with LceUseField. |
strValue |
Pointer to the array to receive the returned value. The field value is stored in this parameter once the function has executed successfully. It will be a zero length string if no default value is specified in the Data Dictionary. The size of strValue should be at least the maximum size of the field. |
iValueSize |
The size (in bytes) of the strValue. |
pulFlags |
Identifies the returned value as *SQLNULL. If the field has a default value of *SQLNULL pulFlags will return 1 otherwise it will return 0. |
Return Values
TRUE is returned if the session has got the field's default value (or zero length string).
FALSE is returned if an error occurs.
Notes
The LceGetDefaultValueU function uses string parameters. Even if the field you are getting is numeric, it will contain a string value representing the default numeric value. You will need to convert the string value to a numeric before using it in your application. Note also that no edit code or word will be applied and that any "decimal point" used (if appropriate) will be that which applies on the host. If the returned string is for a Date or Time, the format will be that of the current locale.
If a non-Unicode field is passed to this function, it will call LceGetDefaultValueX and the returned value will be automatically converted into Unicode.
- This function may be executed at any time after the session is opened.
- This function communicates with the host for all initial calls for a given field name. If the field is defined as dynamic (i.e. the contents can change at any time) each subsequent call will retrieve the latest version of the field from the host.
Tip
Wherever possible, for data entry screens, default values should be defined in the Repository to reduce the amount of keying required.
Related Functions