Form instance count

Find the number of form instances where the rule is run on two-Section forms.

Rule description: there should not be more than five form instances recorded on the Target Lesion form, or a query is issued.

Rule expression

 If(organ!==null || vst!==null || assess!==null)
var cnt= list2SInstances(lesid,null,0);
if(cnt.length>5)
{
return false;               //System sends query when return false condition is met
}
else
{
return true;
}

Query message: There are five or less Target Lesion measurements expected, please verify and correct.

Definitions

organ

An item in the form (Including items in flat section and table section).

vst

An item in the form (Including items in flat section and table section).

assess

An item in the form (Including items in flat section and table section).

lesid

Target item which is Flat section item.

list2SInstances( )

Lists all table instances of the passed-in variable in a two-section form. Takes an item variable of the table section in the form as a parameter.

Return value

Boolean

Returns either true or false. System raises query when return false condition is met.

Usage tips

To make sure the rule runs whenever any of the items in the table section of a two-section form is completed or updated, you must create global variables for each of them and use the variables to evaluate if any of these are not null. This is done in the first line of the rule expression.

Note:

For this evaluation, you should not include the item passed as a parameter to the ListRFInstances( ) helper function in the rule expression logic.

Verification steps

  1. Using a subject for testing, go to the given visit and form containing the iems to check, in this example the Lesion ID <lesid> in the Target Lesion form.
  2. Create form instances updating the form item lesid as in the following table and verify the result is as listed:
    Step Result

    a. Create a first instance of a two-section form (Form1) and enter the lesid item with any value'.

    No query

    b. Create a second instance of a two-section form (Form2) and enter the lesid item with any value'.

    No query

    c. Create a third instance of a two-section form (Form3) and enter the lesid item with any value'.

    No query

    d. Create a fourth instance of a two-section form (Form4) and enter the lesid item with any value'.

    No query

    e. Create a fifth instance of a two-section form (Form5) and enter the lesid item with any value'.

    No query

    f. Create a sixth instance of a two-section form (Form6) and enter the lesid item with any value'.

    Query in all six instances.

    g. Delete Form2.

    No query

Note:

Repeat the above steps if the form is present in multiple visits.