Value.RepeatIndex4 Property

[Read/Write] This property specifies the fourth repeat index for the Value. For non-repeated variables, this index is -1.

Syntax

public int RepeatIndex4 { set; get; }

Example

This example opens an existing answer file and iterates through its Answers. The name of each Answer, and the value of each Value, is written to the console.

public class ExampleCode
{
    static void Main()
    {
        // Create an AnswerCollection and populate it with an existing answer file.
        HotDocs.Server.AnswerCollection ac = new HotDocs.Server.AnswerCollection();
        ac.Open(@"c:\temp\JohnDoe.anx");
         
        // Iterate through each Answer.
        foreach (HotDocs.Server.Answer ans in ac)
        {
            System.Console.WriteLine(ans.Name);
            // Iterate through each Answer's Values.
            foreach (HotDocs.Server.Value val in ans)
            {
                System.Console.Write(" " +
                    val.RepeatIndex1.ToString() + "," +
                    val.RepeatIndex2.ToString() + "," +
                    val.RepeatIndex3.ToString() + "," +
                    val.RepeatIndex4.ToString() + ": ");
                 
                if (val.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[]) val.value;
                     
                    for (int i = 0; i < valArray.GetLength(0); i++)
                    {
                        System.Console.Write(valArray[i].ToString());
                        if (i < (valArray.GetLength(0) - 1))
                            System.Console.Write("|");
                        else
                            System.Console.WriteLine();
                    }
                }
                else
                    System.Console.WriteLine(val.value.ToString());
            }
        }
        ac.Dispose();
    }
}