TFormer_SetVarValue
Provide Data · String encodings
Definition
Windows: ANSI; Unix: UTF-8
ERRCODE TFormer_SetVarValue(HTFORM pInstance, LPCSTR szVarName, LPCSTR szVarValue);
Windows only: UTF-16
ERRCODE TFormer_SetVarValueW(HTFORM pInstance, LPCWSTR szVarName, LPCWSTR szVarValue);
Contract
Sets the value of a DataField.
Returns
ErrOk (0) in case of success, non-zero if an error occurred
Parameters
| Parameter / type | Description |
|---|---|
pInstanceHTFORM |
|
szVarNameLPCSTR / LPCWSTR |
|
szVarValueLPCSTR / LPCWSTR |
|
Remark
Must be called for each DataField after a call to TFormer_NewRecord. All data is passed to TFORMer as string - TFORMer converts this string automatically into the specified data-type (see EVarType). Validation rules stored in the FormLayout or Repository are evaluated when records are read during output generation, not by this function. Check the return code of TFormer_Print or TFormer_PrintToStream for validation errors. If this function is not called for a DataField used in a FormLayout, then the content of this DataField depends on TFormer_SetReuseValues.
If you want to identify the DataFields which are available in a Project or FormLayout, please use the function TFormer_GetFirstProjectVarIt.
Note
Numeric conversion is permissive and can ignore non-numeric characters. Validate numeric strings in your application if strict format checking is required. If this function returns an error, retrieve details with TFormer_GetLastErrorDescription, TFormer_GetLastErrorInformation and TFormer_GetLastErrorSource.