Answer.RepeatIndexes Property  

[Read-only] This property is a RepeatIndices object, which represents the current set of repeat indexes for the Answer. Since an Answer may contain any number of Values, the repeat indexes serve as a "pointer" to reference individual Values. For example, if you want to reference the second Value in of a simple repeated variable, set its repeat indexes to 1,-1,-1,-1.

Syntax

public HotDocs.Server.RepeatIndices RepeatIndexes { 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();
    }
}