FindMatchingRepeatingForm( )

Find a repeating form instance that contains a value that matches the search value.

For this function:

  • 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>

Note:

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

variable(s)
Item variable to search.

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.
value(s)

Search values.

These valuesmust be hard-coded and cannot be rule variables:
  • Dates must be provided inside the string 'Date(dd-mmm-yyyy hh:mm:ss)'.
  • You can use partial dates in the following formats:
    • <dd-mmm-yyyy hh:mm>
    • <dd-mmm-yyyy hh>
    • <dd-mmm-yyyy>
    • <mmm-yyyy>
    • <yyyy>
  • Times must be provided inside the string 'Time(hh:mm:ss)'.
  • You can use partial times in the following formats:
    • <hh:mm>
    • <hh>

Return value

Returns -1 if no matches are found or the index number (>0) of the form instance if at least one matching instance is found. If multiple instances are found, only the first index is returned.

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.

Example 3-48 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.