Understanding Rule conditions - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Understanding Rule conditions

Last post 01-11-2011 06:00 PM by ZhenYuan. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-11-2011 03:31 AM

    Understanding Rule conditions


    I am stumped by how rule conditions work when there are multiple fields to consider. For example if there are 3 fields, "A", "One", and "Two" and want to set a "Results" field to be = 1 if "A" is blank and ("One" or "Two" is not blank).

    Do I set the condition as IF: A is blank and One is not blank or Two is not blank? What happens if I set it as IF:  One is not blank or Two is not blank and A is blank?

    Will my second statement be recognized as ("One" or "Two" is not blank) and ("A" is blank)? Or will the AND condition take precedence and cause my second condition to be (One is not blank) OR (Two is not blank and A is blank)?

     I have 4 fields to do such filtering and this logic is driving me nuts... So how does InfoPath read its condition statements?


    Bangs head on wall,

    Zhen Yuan

  • 01-11-2011 03:39 AM In reply to

    Re: Understanding Rule conditions

    And what happens if my IF condition is: A is blank and One is not blank or Two is not blank?

    Will it be read as (A is blank) and (One is not blank or Two is not blank)


    (A is blank and One is not blank) or (Two is not blank)

  • 01-11-2011 07:35 AM In reply to

    Re: Understanding Rule conditions

    I couldn't give you a definitive answer without doing some experimenting myself, but generally in computing contexts, AND has a higher associativity than OR, which means that ANDs are grouped before ORs. This is true for XPath as well, so my guess is that in your example, the latter version is the way the logic would be evaluated.

    The condition builder dialog in InfoPath is ambiguous when you start mixing ANDs and ORs, so I would suggest that rather than doing so and causing yourself or someone else some confusion and headaches down the road, that you either:

    -Handwrite one large expression, combining the ANDs and ORs the way you want with parentheses, or...

    -Arrange your condition so that you are only using either AND or OR in the dropdowns, and use handwritten expressions for the sub-conditions where necessary, e.g.:

    A is blank  [AND]<---dropdown

    (B != '' or C != '')

    This way there is no ambiguity, and no confusion.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-11-2011 06:00 PM In reply to

    Re: Understanding Rule conditions

    Thanks Jimmy for your suggestion! I was all resigned to do coding already...

    Using expressions to act as parenthesis works!

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.