GetField Function

This function is called shortly after execution returns from the ChooseRecord entry point if the Unicode version of this function (GetFieldW) is not defined. It is called a number of times to retrieve the data from the individual fields of the selected record in the answer source application.

If you need HotDocs to pass a Unicode string to this function, use GetFieldW.

Syntax

long GetField ( long key, LPCSTR fieldName, long typeID, LPSTR data, long maxLen )

Parameters Description
key The record key returned by ChooseRecord.
fieldName The name of the field whose value is requested.
typeID The variable type of the field whose value is requested. (See HotDocs Data Types.)
data A buffer to contain the field value, as an 8-bit string with Windows-1252 encoding. Pass the string <^UNANSWERED^> to indicate that the field should be set to unanswered in HotDocs. If you pass an empty string, HotDocs will not change the current answer for that variable.
maxLen The maximum size (in bytes) of the data buffer.

Return Value

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

Example (Visual C++)

The following Visual C++ example returns a field value.

long WINAPI GetField( long key, LPCSTR fieldName, long typeID, LPSTR data, long maxLen )

{

  if (key == 129)

    {

      if (_stricmp(fieldName, "First Name") == 0)

        {

          strncpy_s(data, maxLen, "Greg", maxLen);

          data[maxLen-1] = '\0';

          return HD_SUCCESS;

        }

      else if (_stricmp(fieldName, "Last Name") == 0)

        {

          strncpy_s(data, maxLen, "Jones", maxLen);

          data[maxLen-1] = '\0';

          return HD_SUCCESS;

        }

    }

  return HD_FAILURE;

}