FindDuplicateRepeatingFormWithinRange( )

Detect duplicate data across repeating form instances for a given item and within the same date range. The data is identified by a form ID which has duplicate item values for the search keys provided. The rule target should be on the corresponding repeating section item.

The first two parameters should always be the date range. Additional search keys can be provided.

  • 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.
  • If a record has no data entered for the required dates, the record is skipped for comparison.

This is an aggregation function. The rule will be run for each form instance in the case where the target is on a repeating form.

Syntax

FindDuplicateRepeatingFormWithinRange('startDateVariable', 'endDateVariable', 'variable1',...)

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
startDateVariable Required Date item on a repeating form, used as the start date for the date range to evaluate.
endDateVariable Required Date item on a repeating form, used as the end date for the date range to evaluate.
variable(s) Optional Item variable to check, passed in using single quotes.

Return value

Boolean (true or false) value:
  • True if duplicate values are found.
  • False if duplicate values are not found.

Examples

Example 3-44 Check to see if any repeating form instances exist within the same onset date range and symptom value

// Given 5 repeating form instances with items "onsetStartDate", "onsetEndDate and "Symptom"
if (FindDuplicateRepeatingFormWithinRange('itmOnsetDateStart', 'itmOnsetDateEnd', 'itmSymptom') === true) {
  return false;
} else {
  return true;
}
 
// Fires a query if more than 1 repeating form instance is found within the same symptom value within the same date range.
//
// Note: If any repeating form instance has a null start or end date then the system assumes a date in order to successfully
// perform the date range overlap check. If the start date is null then the system assumes it to be 01 Jan 0001 and if the
// end date is null then it is assumed to be 01 Dec 3099.