default values for repeating items

You may find yourself in a situation where you must design a CRF with repeating items. For example, a scan is made and different parts of the body should be scored. What you normally do is make a group for these scores and for the area you define a single-select with values Skull, Vertebral column and Ribs. The user must choose these three areas in the first column and add a score in the second column.


fig. 1: CRF for scan

No problem there, but what if in your Study, always the same items must be scored? For example: for each scan you must have a score for the three areas? You would want your CRF to open like this:


fig. 2: same CRF with defaults

This can be achieved by using the InsertAction. And to make things nice and neat, we will add a ShowAction as well.
Start with setting the GROUP_REPEAT_NUMBER and the GROUP_REPEAT_MAX both to 3 and then setting the default status of the Group with the areas to HIDE.


fig. 3: attributes of the group

time for a Rule-file

Now we must write the rules. We will start with collecting the IDs of the items and of the group. (See Two ways of finding the OpenClinica-ID's (OID's) for a rule. Because this is version 3.1 we will only need the item OIDs plus the OID of the Group with the repeating items: OIDs for Event and CRF-version are not needed. Write these OIDs in he header of your Rule-file. (Did I mention Notepad++?)


fig. 4: header with the OIDs

Our target will be the item asking Was scan done?: if this question is answered with 1, Done, then we want to display the group and set the defaults. This is done by the expression I_TDSDE_SCANDONE eq 1.


fig. 5: target plus expression

The ShowAction is straightforward: the DestinationProperty is the OID of the Group and the message must be something like Please complete the details of the scan.


fig. 6: the ShowAction

The last thing to do is set the defaults. We will do this with an InsertAction, or rather with three InsertActions, because we want to set three rows of the RepeatingGroup. You can refer to these rows of the group by adding an ordinal to the OID of the group. The first row is IG_TDSDE_LESIONS[1] and the area-item in this row is referred to as IG_TDSDE_LESIONS[1].I_TDSDE_ANATOMIC_SEGMENT. If we want to set this to the value Skull, then the DestinationProperty of our InsertAction will be DestinationProperty OID="IG_TDSDE_LESIONS[1].I_TDSDE_ANATOMIC_SEGMENT" Value="Skull". And then likewise the second row can be set to Vertebral column and the third to Ribs


fig. 7: the InsertAction

and in real life ...

How does all this present itself to the users? Well, very nicely, in fact. The CRF is opened with only the question if the scan was done. Then after answering this and clicking the Save-button our message is displayed, plus the table with our defaults.


fig. 8: the rule in action

Click here for the XML-file

Other how-to-pages can be found here.

this page was last reviewed August 2013