6 17 LceGetDefaultValueX

LANSA Open Guide

6.17 LceGetDefaultValueX

Retrieves the default value of a 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,

 

 

 char far *

StrValue,

 

 

 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 must be at least FIELD_DATA_SIZE + 1 as defined in the LCOE.H header file.

pulFlags

Identifies the returned value as *SQLNULL. If the field has a default value of *SQNULL 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 LceGetDefaultValueX 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.

Use LceGetDefaultValueU for Unicode fields.

  • 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

LceGetDefaultValueU

6.29 LceGetFieldValueX

6.23 LceGetFieldHeading

6.24 LceGetFieldHelpText

6.25 LceGetFieldIndicator

6.26 LceGetFieldLabel

6.33 LceGetFileType