BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  ODM Rules not handling UNKNOWN variables correctly

    Posted Fri September 27, 2019 10:43 AM
    In the ODM documentation it says you can use logical operators with UNKNOWN.  But it is not working for me.  I am using Decision Center 8.10 with decision engine 1.40.7 and my rule looks like this.

    if m10 is abnormal
    or m13 is abnormal
    then print "YES";
    else print "NO";

    the m10 is a variable that is an object and the object has a boolean function isNormal().  When I call the rule engine and EITHER of the m10, m13 is missing, then nothing is printed.

    When I pass both m10 and m13, then it prints YES/NO  correctly.  But this is wrong!  If m10 is abnormal and m13 is missing, it should print "YES".  But it doesn't print anything.  Is there something option that I need to enable to allow the UNKNOWN to be working correctly?

    By the way, I tried a hack as follows...

    if (m10 is not null and m10 is abnormal )
    or (m13 is not null and m13 is abnormal)
    then print "YES";
    else print "NO";

    and surprisingly this works!!  I get "YES" when m10 is abnormal and m13 is missing.  But that is very confusing to me. Why should the second rule behave any differently than my original rule??!?!  it makes no sense.






    ------------------------------
    John Henckel
    ------------------------------


  • 2.  RE: ODM Rules not handling UNKNOWN variables correctly

    Posted Mon September 30, 2019 10:24 AM
    Edited by Jay Birchmeier Mon September 30, 2019 10:40 AM
    Hi John,

    I was able to make this work.   I believe that you are missing one setting.  You have to turn on the "Automatic Exception Handling in Conditions".  I have attached a screenshot.   I believe that this can only be set from Rule Designer and is not accessible in the Decision Center.  

    I guess that I will add that you just want to be certain that you want the resulting behavior of turning this on.  Each condition can then be evaluated at True, False, or Unknown as the article that you referenced describes and it could impact other rules.

    I hope this helps!

    Automatic Exception Handling in Conditions


    ------------------------------
    Jay Birchmeier
    jbirchmeier@gmail.com
    517-490-3303
    ------------------------------



  • 3.  RE: ODM Rules not handling UNKNOWN variables correctly

    Posted Mon September 30, 2019 04:40 PM

    Great, thanks for telling me about the "automatic exeception handling" checkbox.  I didn't know that.  That gets me closer to a solution. 

     

    However it appear to me that this flag does not affect missing top level objects.  For example I have a rule such as "if the age of 'the person' is less than 25 or true then print YES else print NO".  You would expect it to always print YES, because of the "or true".  Assume autoexception is checked.  If I pass a person with missing age, this prints YES.  However if the entire person is missing, this does not print anything (neither YES nor NO).  Why is that?  Maybe I need to declare an default value of the person to null?

     

    John Henckel






  • 4.  RE: ODM Rules not handling UNKNOWN variables correctly

    Posted Mon September 30, 2019 05:15 PM

    Great, thanks for telling me about the "automatic exeception handling" checkbox.  I didn't know that.  That gets me closer to a solution. 

     

    However it appear to me that this flag does not affect missing top level objects.  For example I have a rule such as

    if
        the age of 'the person' is less than 25
        or true
    then print "YES";
    else print "NO";

    You would expect it to always print YES, because of the "or true".  Assume auto-exception is checked.  If I pass a person with missing age (or with age null), this prints YES.  However if the entire person is missing, this does not print anything (neither YES nor NO).  Why is that? 

    And here is a curious puzzle!  Suppose I change the rule as follows...

    if 
        'the person' is null 
        and the age of 'the person' is less than 25
        or true
    then print "YES";
    else print "NO";

    when I call ODM with missing person it will print "YES".  The reason is that by putting the "is null" condition in front of the rule we have tricked ODM into actually executing it, which generates a NPE, which is "handled" by returning UNKNOWN, and finally   UNKNOWN OR TRUE is evaluated to TRUE.

    But I would rather not put "is null" checks all over my rules, just to trick ODM.  I tried setting the initial value of the person to null, but this had no effect.  Other ideas?



    ------------------------------
    John Henckel
    ------------------------------



  • 5.  RE: ODM Rules not handling UNKNOWN variables correctly

    Posted Fri October 11, 2019 03:27 PM
    In case anyone else has this problem, here is the solution that worked for me. (1) enable auto exception handling (2) make sure that any of the parameters (in, in/out, out) that are objects have initial values that are NOT null in the variable set.  For example make sure 'the person' has initial value of a zombie person object.  THat way, if the caller neglects to pass a person, it will be assigned to a zombie object. And you must ensure that all the "getter" methods on your zombie implementation will throw NPE.  When NPE is thrown during condition evaluation, it is converted to "unknown" by the AEH, ie. U&T=U, U&F=F, etc.

    ------------------------------
    John Henckel
    ------------------------------