HotDocs_Online.Answer Object
An Answer contains the Value (or values) for a particular HotDocs variable. For example, the Answer for a non-repeated variable consists of a single piece of data (text string, number, date, or other information) stored in a single Value. The Answer for a repeated variable, however, consists of multiple Values—one for each value gathered by the interview and merged into the document.
There are several ways to iterate through the Values of an Answer. If you know the repeat indexes for the Value you want to retrieve, you can simply set the 0-based repeat indexes of the Answer to those indexes. Thus, if you want to retrieve the second Value of a simple repeated variable, you could set the Answer's repeat indexes to 1,-1,-1,-1. (Unused indexes should be set to -1.) Once these indexes are set, retrieving the Answer's Value will return the data stored in the Value with the specified repeat indexes.
You can also use the ValueIndexes property to retrieve a list of repeat indexes for each Value in an answer. This is useful when you want to find all of the Values in an Answer, but you do not know the repeat indexes ahead of time. For example, an Answer that contains 5 Values nested two levels deep might return a list of ValueIndexes like this:
- 0, 0,-1,-1
- 0, 1,-1,-1
- 1, 0,-1,-1
- 2, 0,-1,-1
- 2, 1,-1,-1
You can then iterate through this list, setting the Answer's repeat indexes and retrieving the corresponding Value with each iteration.
Interface Information
ProgID: | HotDocs_Online.Answer.11.0 |
Version Independent ProgID: | HotDocs_Online.Answer |
CLSID: | {0F67DCB5-9144-4608-B7B4-EAA2C4F989F8} |
_Answer Interface: | IID: {C5B88631-1307-45F1-AA9E-444E53646293} |
_Answer2 Interface: | IID: {C5B88632-1307-45F1-AA9E-444E53646293} |
_Answer3 Interface: | IID: {C5B88633-1307-45F1-AA9E-444E53646293} This is the primary interface and the main public interface exposed by the HotDocs_Online.Answer object. It was added for the release of version 2006. |
_AnswerEvents Interface: | IID: {46F3DBF9-C555-4f84-99F2-629DC325E2CB} |
Methods
Method | Description |
Add | This method adds a new Value to the Answer object. |
Clear | This method removes all values (Value objects) from the Answer. |
GetRepeatCount | This method gets the number of repeats at a particular level. |
Item | Returns the specified item from the Answer object. |
IterateValues | This method iterates through all the values contained in an Answer and fires OnValueFoundEvent for every value found. |
Remove | This method removes the first occurrence of a specific object from the Answer list. |
Properties
Property | Description |
ACHandle | [Read/Write] This property provides an identifier for the AnswerCollection to which the Answer belongs. |
Count | [Read-only] This property returns the number of values in an Answer object. |
Name | [Read/Write] This property is the name (i.e., variable name) of the Answer. |
Type | [Read/Write] This property sets or returns a number corresponding to a variable type from the ansType enumeration. |
TypeText | [Read/Write] This property lets the user get and set the variable type for an answer using text strings, rather than the ansType enumeration. |
ValueIndexes | [Read-only] This property returns an Nx4 dimension array containing repeat indexes for all Values contained in an Answer, where N is the number of Values and each row in the array represents the repeat index set for a particular Value. If an Answer is "unanswered," the return value is empty. This property allows an integration to easily learn the details of all repeated Values of an Answer, which would be much more difficult using other API methods. |
Events
Event | Description |
OnValueFoundEvent | This event is fired when IterateValues finds a value in an Answer. |