FindMatchingRepeatingForm( )

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

Consider the following 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>
This is an aggregation function. The rule is run for each form instance in the case where the target is on a repeating form.

Note:

This rule helper function is not supported for use in Screen Candidate rule execution.

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

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.