findDuplicate2SFormWithinRange( )

Detect duplicate data across two-section form instances for a given item within the same date range, either within the flat section or the repeating section. The data is identified by a form ID which has duplicate item values for the search keys or date ranges 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 instance in the case where the target is on the repeating section of a two-section form.

Syntax

findDuplicate2SFormWithinRange(formInstance,'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
formInstance Optional Indicates the form instance in which the search is to be performed.
  • If null and variable in the flat section, will search for a duplicate in the flat section across all form instances.
  • If null and variable in the table section, will search for a duplicate in all table rows across all form instances.
  • If a formInstance value is provided, the search will be performed across all the table rows of the specified instance.
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-63 Check to see if any instance exist within the same onset date range and symptom value across all two-section form instances.

// Given 5 repeating form instances with items "onsetStartDate", "onsetEndDate and "Symptom"
if (findDuplicate2SFormWithinRange(null,'itmOnsetDateStart','itmOnsetDateEnd','itmSymptom') === true) {
  return false;
} else {
  return true;
}
 
// Fires a query if more than 1 repeating instance in a two-section form is found within the same date range and with the same symptom.
//
// Note: If any repeating instance of the two-section form 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.