6 58 LceSetFieldValue

LANSA Open Guide

6.58 LceSetFieldValue

Sets the field value in the field information area. This function is very important. It is used to assign values to fields in an information area, so that they may be used in other functions, such as LceFetch.

BOOL

LceSetFieldValue

(int

iSession,

 

 

 char far *

strFieldName,

 

 

 char far *

strValue )

  

Parameters

iSession

The session identifier as returned by LceGetSessionId.

strFieldName

The name of the field as used in the Repository. This field must have been declared using an LceUseField function.

strValue

The string which contains the value. The length of this parameter should not exceed RDMLX_FIELD_DATA_SIZE + 1 as defined in the LCOE.H header file. A NULL pointer indicates the value is *SQLNULL.

  

Return Values

TRUE is returned if the session has set the field value.

FALSE is returned if an error occurs.

Notes

This concept may be difficult to understand, but you must remember that you are accessing data on a server and not locally. You do not have the files and their field characteristics stored locally. The file and field definitions are not compiled into your applications. As a developer, you may know that the employee number "EMPNO" is an integer, but the application has no way of knowing this until it connects to the server. Consequently, the intermediate step of setting field values and getting field values is required.

The LceSetFieldValue function uses string parameters. Even if the field you are setting is a numeric, it must be assigned a string value. You must convert the numeric value to a string before using it in this function.

An error will be generated if you attempt to assign *SQLNULL to a field which does not have the ASQN input attribute. Use LceGetFieldAttributes to determine if a field can be assigned *SQLNULL.

If the field is a Unicode type (NChar or NVarchar), the value will be automatically converted to Unicode and the LceSetFieldValueU function called.

  • This function may be executed at any time after the session is opened.
  • This function performs no communications to the host.

Related Functions

LceSetFieldValueU

6.29 LceGetFieldValueX

6.18 LceGetDefaultValueU