Answer.ValueIndexes Property

[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.

Syntax

public int[,] ValueIndexes { get; }

Example

The following Visual C# code opens an answer file, iterates through its AnswerCollection, and displays each Answer and its Values. After each value, it also displays the RepeatCount at the current level.

public class ExampleCode
{
    static void Main()
    {
        HotDocs.Server.AnswerCollection ac = new HotDocs.Server.AnswerCollection("c:\\temp\\JohnDoe.anx");
         
        foreach (HotDocs.Server.Answer ans in ac)
        {
            System.Console.WriteLine(ans.Name);
             
            // Iterate through each of the Answer's Values.
            int[,] myArray = ans.ValueIndexes;
            for (int i = 0; i < myArray.GetLength(0); i++)
            {
                ans.RepeatIndexes[0] = myArray[i, 0];
                ans.RepeatIndexes[1] = myArray[i, 1];
                ans.RepeatIndexes[2] = myArray[i, 2];
                ans.RepeatIndexes[3] = myArray[i, 3];
                 
                System.Console.Write("{0},{1},{2},{3}: ", ans.RepeatIndexes[0].ToString(), ans.RepeatIndexes[1].ToString(),
                    ans.RepeatIndexes[2].ToString(), ans.RepeatIndexes[3].ToString());
                 
                if (ans.Value.GetType().IsArray)
                {
                    // This means the value is an array, such as a "select all that apply" Multiple Choice value.
                    System.Object[] valArray = (System.Object[])ans.Value;
                     
                    for (int j = 0; j < valArray.GetLength(0); j++)
                    {
                        System.Console.Write(valArray[j].ToString());
                        if (j < (valArray.GetLength(0) - 1)) System.Console.Write("|");
                    }
                }
                else System.Console.Write(ans.Value.ToString());
                System.Console.WriteLine(" (RepeatCount: " + ans.RepeatCount + ")");
            }
        }
        System.Console.ReadKey();
    }
}