SetFieldW Function

This function is called by HotDocs 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 2009 to support Unicode strings. Earlier versions of HotDocs will not call this function.

Syntax

long SetField ( long recordID, LPCWSTR fieldName, long typeID, LPCWSTR 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 SetFieldW(long recordID, LPCWSTR szFieldName, long typeID, LPCWSTR value)

{

  return HD_SUCCESS;

}