SetField Function

This function is called by HotDocs (if the Unicode version of this function, SetFieldW, is not defined) to set a new value for a particular field of a specified record in the answer source.

This function was introduced with the release of HotDocs 2005 SP2. Earlier versions of HotDocs will not call this function. If you need HotDocs to pass a Unicode string to this function, use SetFieldW.

Syntax

long SetField ( long recordID, LPCSTR fieldName, long typeID, LPCSTR value )

Parameters Description
recordID The record identifier (key) for the record whose field is to be set. This recordID will be in an opened state ready for read/write access.

HotDocs assumes that all record IDs returned by an answer source are greater than or equal to zero. That is, negative record IDs are not allowed.  

fieldName The name of the field that is to have its value set.
typeID The variable type of the field whose value is being set.
value The new value to be stored in the field. This string will be formatted as follows for each variable type:
  • TEXT: As is, no special formatting.
  • NUMBER: A valid number containing only digits and optionally a decimal point and negative sign.
  • DATE: YYYY-MM-DD
  • TRUE/FALSE: “TRUE” or “FALSE”
  • MULTIPLE CHOICE: CHOICE1|CHOICE2…|CHOICEn
If the value in HotDocs is unanswered, HotDocs will pass the following string: ^UNANSWERED^. This value should be treated logically like a database NULL value (no value exists).

Return Value

Return HD_SUCCESS (1) if successful, and HD_FAILURE (0) if otherwise.

Example (Visual C++)

The following Visual C++ example returns HD_SUCCESS:

long WINAPI SetField(long recordID, LPCSTR szFieldName, long typeID, LPCSTR value)

{

  return HD_SUCCESS;

}