GetMatchingRepeatingFormsCount( )

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

  • 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 as a string using the following format: '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 as a string using the following format: 'Time(hh:mm:ss)'.
  • You can use partial times in the following formats:
    • <hh:mm>
    • <hh>

Syntax

GetMatchingRepeatingFormsCount('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 Required Rule variable to evaluate, passed in using single quotes.
value Required Value to search for.

Return value

Number that represents the count of repeating form instances that match the passed-in value for the given variable.

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-59 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;