FindMaxInRepeatingForms( )
Find the maximum value of a given number item in all instances of a repeating form. The data is retrieved by form ID and works only for numeric fields.
- You cannot use drop-downs, radio buttons, or checkbox values as function parameters or as a target.
This is an aggregation function. The rule is run for each form instance in the case where the target is on a repeating form.
Syntax
FindMaxInRepeatingForms('variable')
Parameters
Note:
It is allowed to reuse variables passed into this function elsewhere in the rule expression, however you must add the variable as a parameter using single quotes.Parameter | Required/Optional | Description |
---|---|---|
variable |
Required | Item variable to search, passed in using single quotes. |
Return value
Numeric value that constitutes the
maximum value across all instances or
"0"
if no maximum can be
found.
Examples
Example 3-46 Find the maximum value of "weight" number item across all repeating form instances in a visit
// Given 5 repeating form instances with "weight" item containing values of "150, 200, 250, 300, 350"
return FindMaxInRepeatingForms('varWeight');
// returns 350
Parent topic: Repeating form functions