GetFieldName Function

This function is used by HotDocs to enumerate the names and data types of all the available fields in the answer source application if the Unicode version of this function (GetFieldNameW) is not defined. GetFieldName is called repeatedly when a template developer attempts to map variables in a dialog to fields in the answer source, in order to retrieve the list of possible fields for mapping. HotDocs passes 0 in fieldNum the first time it calls GetFieldName (i.e., when it requests the first field name), and increments the number with each successive call. The implementation should set the field name and return the data type of the field.

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

Syntax

long GetFieldName ( LPSTR fieldName, long fieldNum )

Parameters Description
fieldName The buffer for the field name. It can hold up to a maximum of 50 characters plus a NULL terminator.
fieldNum The number of the requested field name.

Return Value

Return the data type of the field (see HotDocs Data Types for a list of data types), or zero (0) to indicate there are no more fields to enumerate.

Example (Visual C++)

The following Visual C++ example uses GetFieldName:

long WINAPI GetFieldName( LPSTR fieldName, long fieldNum )

{

  long maxLen = 50;

    if (fieldNum == 0)

      {

        strcpy_s(fieldName, maxLen, "First Name");

        return 1;

      }

    else if (fieldNum == 1)

      {

        strcpy_s(fieldName, maxLen, "Last Name");

        return 1;

      }

    else

      return 0;

}