We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Rules - ct operator

Hello,

I need help for a rule.
I have 2 variables, one (A) is a single select Yes/No and the other one (B) is a checkbox (mulitple responses possible) 1/2/3/4/5/6/7.
I want to check the consistency between these 2 variables.

First rule should trigger when A is (eq) "No" and B contains (ct) "2". This one is ok.
Second rule should trigger when A is (eq) "Yes" and B doesn't contain (?) "2". I don't know how to do this, since the "not contains" operator doesn't exist.

Do you have a workaround ?

thank you,

Romain.


Comments

  • RCHENURCHENU Posts: 204
    Hey,

    Any idea is welcome :-)

    Thanks !

    Romain.
  • lkeitalkeita Posts: 50
    Hi Romain,

    I did a quick test and this seemed to work:

    I_TEST_A is a yes/no question (1=yes, 0=no)
    I_TEST_B is a checklist that allows for 1,2,3,4,5,6,7 (as in your example)

    I wrote one rule with the following expression:

    (I_TEST_A eq 0 and (I_TEST_B ct 1 or I_TEST_B ct 3
    or I_TEST_B ct 4 or I_TEST_B ct 5 or I_TEST_B ct 6 or
    I_TEST_B ct 7)) or (I_TEST_A eq 1 and (I_TEST_B ct 2))

    And then called a DiscrepancyNoteAction IfExpressionEvaluates="false"

    This twisted my head a bit since I had to think in double negatives, but I think it does the trick!

    The complete rule text is below:

    <?xml version="1.0" encoding="UTF-8"?>


    I_TEST_A



    A is yes and B does not
    contain 2 or A is no and B ct 2




    TEST_AB
    (I_TEST_A eq 0 and (I_TEST_B ct 1 or I_TEST_B ct 3
    or I_TEST_B ct 4 or I_TEST_B ct 5 or I_TEST_B ct 6 or
    I_TEST_B ct 7)) or (I_TEST_A eq 1 and (I_TEST_B ct 2))



    Laura
  • lkeitalkeita Posts: 50
    edited October 2016
    Hmmmm...it didn't seem to post the complete xml as I intended.

    See below:

    Essentially, if you use ct and run the rule if it evaluates to false, that is the same as saying "not ct." So the expression needs to contain ALL the VALID response combinations...if ALL of those evaluate to false, then a discrepancy is flagged.

    I hope this helps!

    Laura
  • lkeitalkeita Posts: 50
    Hmmmm...sorry, Romain...upon further testing, that's not doing the trick. I'm still messing with it and will keep you posted.
  • sfesselsfessel Posts: 6
    Hello,

    I do not have the time to test it, unfortunately. But I thought about a solution like:

    (I_TEST_A eq 1 (=yes) and I_TEST_B ct 2) or I_TEST_A eq 0 (=no)

    and then use evaluates to false. This should trigger only, if yes is selected and the second value does not contain value 2.

    Regards

    Sebastian.
  • RCHENURCHENU Posts: 204
    Hello,
    Thanks a lot for your help.

    @Laura, yes it's not working in all cases.

    @Sebastian, I used your rule (I_TEST_A eq 1 (=yes) and I_TEST_B ct 2) or I_TEST_A eq 0 (=no) and created another one: (I_TEST_A eq 0 (=no) and I_TEST_B ct 2), set to true this time, and it seems that the two rules do the trick. I'm still testing though.


    Romain.
  • Malcolm HartMalcolm Hart Posts: 9
    If you were testing to see if a single value was not contained in a variable and that was all, then using CT and then ExpressionEvaluates=False would work. As soon as you start adding in other variables into the expression with ANDs and ORs, then you have opened a whole new can of worms, since you're now negating a whole set of possibilities. I have a set of 15 checkboxes and need to know if one of them ('Other') has not been selected even though the accompanying 'Other' textbox has been completed. It's so complex that I have given up as I don't have the time or inclination to do the mental gymnastics necessary to work this out.

    Frankly, it's just crazy that there isn't a 'does not contain' operator in OC when 'contains' does exist.
Sign In or Register to comment.