Instance count
Count the number of instances in a repeating form.
Rule description: if the Indication on a Concomitant Medications (ConMeds) form is assigned to an Adverse Event, there should be at least one non-deleted adverse event record present on the Adverse Event (AE) repeating form.
Rule expression
if(AESER!==null || AESERY!==null || AESERYOTH!==null || AESTDT!==null || AEONGO!==null || AEENDT!==null || AEOUT!==null){} //This is to make sure the code runs when any of the other items of the AE form is updated. It does not include the item already used in the code
var indval=getStringFromChoice(INDICAT);
var aecnt=ListRFInstances(AETERM,0);
if(indval.contains("Adverse Event")) //multi-select question. Evaluates for a specific given choice.
{
if(aecnt.length<=0)
{
return false; //System sends query when return false condition is met
}
else
{
return true;
}
}
else
{
return true;
}
Query message: Medication is indicated as being taken for an adverse event but no records are recorded on the Adverse Events (AE) eCRF. Please verify.
Definitions
- INDICAT
-
Corresponds to the Indication on a Concomitant Medications (ConMeds) form from the rule description.
- AETERM
-
Corresponds to the Adverse Events records on the Adverse Event (AE) form from the rule description.
- AESER, AESERY, AESERYOTH, AESTDT, AEONGO, AEENDT, AEOUT
-
Items in the repeating form.
- aecnt
-
Defined JavaScript variable that stores a list of instances. When using
aecnt.length
we retrive the number of instances contained in this list. - getStringFromChoice( )
-
Converts selected label for the choice element (drop-down, radio buttons or checkboxes) to a string or a comma-separated value. Takes in the choice element as parameter.
- ListRFInstances( )
-
Lists all repeating form instances of the passed-in variable. Takes an item variable in the form as a parameter.
Return value
Usage tips
To make sure the rule runs whenever any of the items in the repeating 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
- Using a subject for testing, go to the given visit and form
containing the iems to check, in this example the indication
<
INDICAT
> on the Concomitant Medications form. - Update the form item
INDICAT
as in the following table and verify the result is as listed:Step Result a. Assign the
INDICAT
item to an adverse event.Query
b. Go to the first repeating form instance of the Adverse Event form and complete all items of the repeating form for which it is required to check atleast one non deleted instance is present:
AESER
,AESERY
,AESERYOTH
,AESTDT
,AEONGO
,AEENDT
, andAEOUT
.No query
c. Clear all the item in the first repeating form instance completed in previous step.
No query
d. Delete the first repeating form instance.
Query
e. Update the
INDICAT
item so it is not assigned to an adverse event.No query
f. Update the
INDICAT
item so it is assigned to an adverse event again.Query
g. Create a second repeating form instance and enter only one item or less than all the items of the repeating form for which it is required to check atleast one non deleted instance is present.
Query
h. Create third repeating form instance and complete the remaining required items from previous step in that third repeating form instance.
Query
i. Complete the remaining required items in the second repeating form instance.
No query
j. Delete the third repeating form instance.
No query
Note:
Repeat the above steps if the form is present in multiple visits.
Other examples
Example 4-26 If 'Was a follow-up lesion assessment performed?' if 'No,' then there isn't a non-deleted add entry record present on TARGET
if(R2!==null || R3!==null || R4!==null || R5!==null || R6!==null || R7!==null || R8!==null){}
var chk1val=getStringFromChoice(FOLLOWASS);
var tarcnt=ListRFInstances(R1, 0);
if(chk1val.contains("No"))
{
if(tarcnt.length<=0)
{
return true;
}
else
{
return false;
}
}
else
{
return true;
}
Query message: You have selected No. However, information has been recorded. Please review and correct.
Parent topic: Repeating form examples