HotDocs.Server.RepeatIndices Class

This class represents the repeat indexes for an answer.

Namespace: HotDocs.Server
Assembly: HotDocs.Server in HotDocs.Server.dll

 Methods

Method Description
Clear This method clears the repeat indexes.
Reset This method resets the repeat indexes.

Priorities

Priority Description
Count [Read-only] This property returns the number of items in the RepeatIndices collection.
IsReadOnly [Read-only] This property returns the number of items in the RepeatIndices collection.
Item Access the repeat index for a specific repeat depth.

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();
    }
}