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.

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

Note:

This rule helper function is not supported for use in Screen Candidate rule execution.

Syntax

ListRFInstances('variable',includeDeleted)

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 or Optional Description
variable Required Item variable to search, passed in using single quotes.
includeDeleted Optional Indicates whether deleted records are included in the output:
  • 0 - Do not include deleted Repeating instances in the return array. This is the default for when no value is provided.
  • 1 - Include deleted Repeating instances in the array count.

Return value

An array of repeating form instance numbers.

Examples

Example 3-55 Check for variable existence

Consider the use case in which a rule is set up to fill in the current system date in Form 1, when Item 1 in Form 1 is Yes. This rule should be re-triggered whenever the value for Item 1 in Form 2 is either entered, updated, or cleared. Each time the rule runs, it should update the current system date in Form 1.

To check if a value exists in Form 2, Item 1, use the following expression:

var form2dt1=ListRFInstances(form2dt1);

Example 3-56 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-57 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) == -1)?false:true;