windowHDAnsGetVal Method |
This function gets the answer value for a variable. It can also get a single (indexed) value from a repeated answer.
JavaScript API: Direct
Assembly: api.js Version: 1.0.0.0 (1.0.0.0)
Syntax
JavaScript
function HDAnsGetVal(vName, ndx, valType);
Parameters
- vName
- Type: string
A variable name. - ndx
- Type: string
[optional] A string of numeric values delimited by colons (:), which represents the 0-based repeat index at each of the four possible levels of repetition. If no index is given, HotDocs assumes the variable is not repeated (equivalent to an index of "-1:-1:-1:-1"). - valType
- Type: string
[optional] The two-character type of variable (TX, NU, DA, TF, MC). If the answer collection contains answers of different type for the same variable name (e.g., one template has a Text variable named "Employee Name" and an inserted template has a Multiple Choice variable named "Employee Name"), specifying the type is important in order to get the expected value from the answer set. If the type is omitted, the first answer found will be returned.
Return Value
Type: objectThe requested value.
- Text, Number or True/False values are represented by native JavaScript strings, numbers or Boolean values, respectively.
- Date values are represented by native JavaScript Date objects.
- Multiple Choice values are reprsented by native JavaScript strings. Pipe (|) characters within the string separate the individual values of a multiple-select value (e.g., "Option A|Option C").
- Unanswered values are representing using null.
Remarks
- "0:-1:-1:-1" represents the first iteration of Dialog1, and could be used to request answers for variables at that iteration.
- "1:-1:-1:-1" represents the second iteration of Dialog1, and could be used to request answers for variable at that iteration.
- "0:0:-1:-1" represents the first iteration of Dialog1's first iteration of Dialog2.
- "2:4:-1:-1" represents the third iteration of Dialog1's fifth iteration of Dialog2.
For more information about answers and repeat indexing, see HotDocs Answers.
See Also