The terms repeat number, row number and cycle number all refer to number of the row in which a question value appears within a question group on an eForm in Data Entry. The first row is numbered 1. (A non-repeating question has a default repeat number of 1).
To refer to a repeating question in an Arezzo expression, use the term
QCode( RowNo )
where QCode is the question code, and RowNo can be an integer, or one of the keywords:
first
last
this
next
previous
You can find these keywords on the Cycling tab of the Arezzo Expression Builder. See image
You can also add or subtract an integer from the above keywords, e.g.
Pulse( last –1 )
refers to the last-but-one repeat of the Pulse question within a group.
The expression
Pulse( this + 1 )
is the same as
Pulse( next )
and, when used in a validation, collect if or derivation for a question in a group, refers to the value of the Pulse question in the next row relative to the current question.
To refer to a repeating question on a particular visit and eForm, use the term
VCode:FCode:QCode( RowNo )
where VCode and FCode are the visit and eForm codes respectively. The visit and eForm may also have cycling specifiers.
For example,
Screening:Vital(2):BPSystolic(last)
refers to the last value of BPSystolic on the second cycle of the Vital eForm in the visit Screening.
You can display a row number in a repeating question group by creating an integer question and setting its derivation to be question:cycle See image
In Data Entry, this field automatically displays the row number for each row. See image
When writing question validations, you should always use the term
me:value
to refer to the currently entered value being validated. The other specifications for questions, especially repeating questions, will only give the correct value after the question has been entered and validated (and thus cannot be used within the validation itself). You can of course use general question specifications when referring to values other than the one being validated.
For example, if a repeating question group has two rows containing a question Weight, the warning condition
Weight(2) < Weight(1)
will not work correctly as a validation on the Weight question itself.
Instead, to validate the second value, use
question:cycle = 2 AND me:value < Weight(1)
To also validate the value in row 1, use the condition
(question:cycle = 1 AND me:value >= Weight(2))
OR (question:cycle = 2 AND me:value < Weight(1))
Note that you do not need to use the question code Weight; you can instead use the keyword question to represent the code of the question for which the validation condition is being run. For example, the following condition is applicable to any question, whatever its code.
(question:cycle = 1 AND me:value >= question(next))
OR (question:cycle = 2 AND me:value < question(previous))