Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

PositionOfRepeater – XpressDox

Please note that with effect from version 11.3, this function has been superseded by the RepeaterPosition function. For backward compatibility the use of PositionOfRepeater is supported, but is discouraged.

Consider the commands OnExitSet and OnEnterSet. These commands are only executed during the lifetime of the interview, and also contain conditions which need to be evaluated when the user navigates through the interview.

Also consider the case where you would like certain actions to take place depending on the position of the current repeater. For instance, you might want to issue a warning as soon as the user adds a new Child repeater into the interview, but only if the new Child is not the first one. This might look like this:

Name: «Name»
«Footing(Name,                        )»

«OnEnterSet(Name,Name,FootingText,(position() > 2),'You have exceeded the recommended number of children','',EvenWhenNotEmpty)»


On the face of it, this would put the “You have exceeded…” message into the footing of data element Name when the position of the new Child repeater is greater than 2.

Unfortunately, the position() function does not operate until the document is being assembled, as it requires the ForEach to be active. There is, however, the XpressDox function PositionOfRepeater() which will do what is required, as follows:

«OnEnterSet(Name,Name,FootingText,(PositionOfRepeater() > 2),'You have exceeded the recommended number of children','',EvenWhenNotEmpty)»

A further feature of this function is easier to describe in the context of an example:


Name: «Name»
Pet’s Name: «PetName»
«Footing(PetName,                        )»

«OnEnterSet(PetName,PetName,FootingText,(PositionOfRepeater(../) > 1),'Only the first Child may have a pet!','',EvenWhenNotEmpty)»


The “../” refers not to the PetName‘s parent in the XML, but one higher, i.e. to the Child containing that Pet collection.