GetMatchingRepeatingFormsCount( )

Get the number of repeating form instances of a form that match the item values provided as search keys.

Syntax

GetMatchingRepeatingFormsCount('variable1', value1, 'variable2', value2, ...)

Parameters

variable
Rule variable.

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

Value to search for.

Return value

Count of matching repeating form instances.

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.

Usage Tips

  • Can accept choice controls (radio controls, check box controls, and dropdowns) but can only be searched by label, not value.
  • Only one option can be provided as search text for choice controls.
  • 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>

Example 3-57 Raise a query if there is more than one instance where AE Outcome = 'Fatal"

// Raise a query if there is more than one instance where AE Outcome = 'Fatal"
 
// Get current repeating instance
var ins = GetCurrentRFInstance();
var curVal = "";
 
// Get value of aeOut from current instance
var rfData = getRFValues('ins', [aeOut] );
if(rfData.exists && rfData.aeOut){
        if((rfData.aeOut) !== "[]"){    // If the choice control has been cleared out then do not read the label
            curVal = JSON.parse(rfData.aeOut)[0].label;
    }
}
 
// check to see if there are more than 1 instance with "Yes"
return ((curVal == "Fatal") && (GetMatchingRepeatingFormsCount('aeOut', "Fatal") > 1))?false:true;