DiscrepancyNoteAction for repeating group

hi everyone,

i'm struggeling to write a rule for oc 3.10.
in the crf there is:
- an initial yes/no question I_2VMED_PREMEDCO
- an repeating group IG_2VMED_DIAG_GROUP (items I_2VMED_DIAG, I_2VMED_ONGOING, I_2VMED_STARTDAT, I_2VMED_STOPDATE )
-
if I_2VMED_PREMEDCO = yes, the group should be shown -> this works straight-forward with a showrule

if I_2VMED_PREMEDCO = no, i'd like to write a DiscrepancyNoteAction that fires if anything has been entered in the repeating group IG_2VMED_DIAG_GROUP -> this doesn't work.


my latest expression looks like this:


I_2VMED_PREMEDCO eq 0 and (
I_2VMED_DIAG ne "" or
I_2VMED_ONGOING ne "" or
I_2VMED_STARTDAT ne "" or
I_2VMED_STOPDATE ne "")


any help would be greatly appreciated.

kind regards
bernhard

Comments

  • ebsebs Posts: 130 ✭✭
    Hi Bernhard,

    For a repeating group you will need to prefix the reference to the group to the item identifier.

    So something like:

    IG_2VMED_DIAG_GROUP[1].I_2VMED_DIAG ne ""

    where [1] points to the first row of the repeating group.

    If you know in advance how many rows you will have then you can write a rule for each iteration of the repeating group.

    RULE1:

    I_2VMED_PREMEDCO eq 0 and (
    IG_2VMED_DIAG_GROUP[1].I_2VMED_DIAG ne "" or
    IG_2VMED_DIAG_GROUP[1].I_2VMED_ONGOING ne "" or
    IG_2VMED_DIAG_GROUP[1].I_2VMED_STARTDAT ne "" or
    IG_2VMED_DIAG_GROUP[1].I_2VMED_STOPDATE ne "")

    RULE2:
    I_2VMED_PREMEDCO eq 0 and (
    IG_2VMED_DIAG_GROUP[2].I_2VMED_DIAG ne "" or
    IG_2VMED_DIAG_GROUP[2].I_2VMED_ONGOING ne "" or
    IG_2VMED_DIAG_GROUP[2].I_2VMED_STARTDAT ne "" or
    IG_2VMED_DIAG_GROUP[2].I_2VMED_STOPDATE ne "")

    etc.

    The following states that you can also specify [ALL] to go through all of the rows but I have never tried that:

    https://docs.openclinica.com/3.1/rules/creating-rules#content-title-4383

    Cheers
    Eric
  • bernhard_jammerbundbernhard_jammerbund Posts: 5
    edited November 27
    hey,

    first of all, thx for the reply, wasn't expecting that :)

    i already tried the [ALL] option, didn't work,
    but your idea with referencing all rows (6 rows is the maximum) explicitly did work, at least i could upload the rule without errors, though it looks a bit ugly:






    however, the rule does not fire.
    do you see any other mistake, maybe?
    thank you in advance!
  • ebsebs Posts: 130 ✭✭
    If you only check row 1 does the rule fire?
  • bernhard_jammerbundbernhard_jammerbund Posts: 5
    edited November 27
    yes it does, but only the first time after i click "save".
    on the 2nd click, nothing happens.

    so maybe i could try to split my RuleDef to 6 seperate rules, get uglier every time, but as long as it works :)
  • ebsebs Posts: 130 ✭✭
    I think it will only raise the discrepancy if it doesn't already exist? i.e. not on the second click.

    We had to split our rules out per row but in our case it made sense as we were looking at them on an individual basis. It leads to a lot of rules to maintain however.
  • GerbenRienkGerbenRienk Posts: 793 ✭✭✭
    Hi Bernard,
    Your all-six-rows-in-one-rule approach will only work if all six rows have data. If not, OC is missing some of the parameters to evaluate the expression, so it will not trigger the action.
    As for specifying the occurrence-number: did you try:
    IG_2VMED_DIAG_GROUP.I_2VMED_DIAG ne ""
    ?
    This should work for each row entered.
    Kind regards,
    Gerben Rienk
  • hi,
    thank you for your reply!

    yes, tried IG_2VMED_DIAG_GROUP.I_2VMED_DIAG ne "", did not work.
    in the meantime it works btw, i've split the rule into 6 parts, 1 for each of the 6 possible group rows.
Sign In or Register to comment.