ListRFInstances( )

List all instance numbers for a repeating form. You can use this helper function in your rule expression to check for instances of a specific question value in a repeating form.

Note:

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

Syntax

ListRFInstances('variable',includeDeleted)

Parameters

variable
An item that exists on the visit or form to search.

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.
includeDeleted
  • null or 0 - Do not include deleted Repeating instances in the return array.
  • 1 - Include deleted Repeating instances in the array count.

Return value

An array of repeating form instance numbers.

Example 3-54 Raise a query if AE form instance #3 does not exist

// Raise a query if AE form instance #3 does not exist
var arrAE = ListRFInstances('onDate', 0);
return (arrAE.indexOf(2) == -1)?false:true;

Note:

In this example, .indexOf(2) equates to the third form instance as arrays start at position zero.

Example 3-55 Raise a query if given form instance number does not exist, using variables

// Raise a query if current form instance number does not exist
var curInst = GetCurrentRFInstance();
var arrAE = ListRFInstances('onDate', 0);
return (arrAE.indexOf(curInst.intValue()) == -1)?false:true;

Note:

Any variables passed when using the JavaScript indexOf() method with ListRFInstances(), should be converted for integer using intValue() to ensure the search works correctly.