FindMatchingRepeatingForm( )
Find a repeating form instance that contains a value that matches the search value.
- You cannot use drop-downs, radio buttons, or checkbox values as function parameters or as a target.
- If a variable is designed to hold a partial date, you must provide the value for
that parameter in the same partial date format. You can use partial dates in the following
formats:
- <dd-mmm-yyyy hh:mm>
- <dd-mmm-yyyy hh>
- <dd-mmm-yyyy>
- <mmm-yyyy>
- <yyyy>
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
FindMatchingRepeatingForm('variable1', value1, 'variable2', value2, ...)
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(s) |
Required | Item variable to search, passed in using single quotes. |
value(s) |
Required | Value for the given variable to search.
These values
must be hard-coded and cannot be rule variables:
|
Return value
Number (>0) that represents the index of the form instance where the
matching value was found.
- If multiple instances are found, only the first index is returned.
- Returns -1 if no matches are found.
Note:
In dates,UNK
values are considered to match any other value. For example:
'Date(01-Feb-2022)'
and 'Date(20-Feb-2022)'
are both
considered as a match of an entry with UNK-Feb-2022
date value.
Examples
Example 3-49 Raise a query if any instances exist where symptom = "headache" and pulse rate = "100"
// Given 5 repeating form instances with items "itmSymptom" and "itmPulse"
if (FindMatchingRepeatingForm('itmSymptom', "headache", 'itmPulse', 100) > 0) {
return false;
} else {
return true;
}
// Fires query if any of the 5 instances contain both itmSymptom = "headache" AND itmPulse = 100.
Parent topic: Repeating form functions