Answer.GetRepeatCount Method

This method returns the number of repeated values at a certain level of the repeat.

Syntax

int GetRepeatCount ( int repeat1, int repeat2, int repeat3, int repeat4 )

Parameter Description
repeat1 First repeat index for the specified value.
repeat2 Second repeat index for the specified value.
repeat3 Third repeat index for the specified value.
repeat4 Fourth repeat index for the specified value.

Return Value

The repeat count for the specified value.

The RepeatCount property returns the repeat count at the current level; however, this method returns the repeat count at an arbitrary level without changing the repeat indexes for the Answer object.

Any unused repeat indexes must be set to -1. For instance, if you want to reference the fourth iteration of the first level of a repeated answer, you would use 3,-1,-1,-1 as the repeat index.

Example

The following Visual C# example displays the number of repeated values at the first repeat level:

public class ExampleCode
{
    static void Main()
    {
        HotDocs.AnswerCollection asc = new HotDocs.AnswerCollection();
        HotDocs.Answer ans = new HotDocs.Answer();
        HotDocs.HDVARTYPE vType = HotDocs.HDVARTYPE.HD_TEXTTYPE;
         
        asc.Create(@"C:\Documents\HotDocs\Answers\AnswerFile.anx");
        ans = asc.Item("Beneficiary Name", ref vType);
        MessageBox.Show(ans.GetRepeatCount(0, -1, -1, -1).ToString());
         
        asc.Close();
    }
}