We are currently working on the forum. For the short-term, all forum content will be in read-only format. We apologize for the interruption and look forward to collaborating with you shortly. All the best in your research!

contextual statements in rules

In chapter 6.4.2 of the OpenClinica documentation it's written:

Now OpenClinica utilizes what is known as contextual statements, meaning as in the examples above you can put ITEM_OID and OpenClinica will automatically complete the statement so to make it legal. Let’s use an example

<Target Context="OC_RULES_V1">SED_OID[ALL].CRF_OID.GROUP_OID.ITEM_OID</Target>

<Expression> ITEM_OID eq 50</Expression>

What will actually happen here when this expression is being evaluated is that ITEM_OID will be substituted by

SED_OID[ordinal].CRF_OID.GROUP_OID.ITEM_OID

So I tried to setup this:

<RuleImport>

  <RuleAssignment>
    <Target Context="OC_RULES_V1">MyEventOID.MyFormOID.MyGroupOID.MyDateFieldOID</Target>
    <RuleRef OID="R1">
      ...
    </RuleRef>
  </RuleAssignment>

  <RuleDef OID="R1" Name="R1">
    <Description>Test date not being in the future</Description>
    <Expression>ITEM_OID gt _CURRENT_DATE</Expression>
  </RuleDef>

</RuleImport>

When trying to import this XML file OpenClinica does reject it with the following error messages:

Invalid Rules

Rule OID Rule Name Description   Potential Import Errors
R1   R1 Test date not being in the future   OCRERR_0013 : The following : ITEM_OID is not valid.

Invalid Rule Assignments

Target  Rules Errors
MyEventOID.MyFormOID.MyGroupOID.MyDateFieldOID
 RuleOID  ActionMessage 
Info
OCRERR_0025: The Rule you are trying to reference does not exist or is invalid. OCRERR_0027: The contextual expression in one of the Rules does not validate against the target expression in the current Rule assignment.

The field is of type 'date'.

Do I misunderstand the documentation or what am I doing wrong here? Finally I would like to use the one rule to check multiple date fields against future date which will only be possible if ITEM_OID can be used as placeholder for the actual item.

Regards

Franz

Best Answer

This discussion has been closed.