InfoPath Rules Grouping Behavior (And New BizTalk Posters)

A buddy at work is designing an InfoPath form and was befuddled by some awkward behavior in the way InfoPath executes its rule conditions.

So let’s say that you want to execute the following comparison:  “If the sum of the order is greater than $500, and, the customer is from either CA or FL, then set a 10% discount rate.”  In essence you have a “A & (B | C)” situation.  So my pal had a rule that fired which checked these conditions.  On the first pass, his rule conditions looked like this:

Makes sense, BUT, where does InfoPath put the parentheses?  Not where we first thought.  The way this rule is written, InfoPath executes it as “(A & B) | C“.  That is, if I just enter “FL” into my textbox, the rule passes because as long as the state equals “FL”, the first condition doesn’t matter.   The “and’s” take precedence over the “or’s”.

So, how do I get the conditions to line up as I really want?  You actually have to break apart the condition to look like “(A & B) | (A & C)” such as:

This way, the two fields on both sides of the “and’s” are grouped together and split by the “or.”

You also max out on the number of rule conditions at 5, so if you have a rule with a large set of conditions, you’ll need to split it up into multiple rules.  I still like InfoPath, but man, I’ve been getting punched in the face by little quirks for the past few weeks.

As a complete non-sequitur, I noticed that the BizTalk team just released yet another poster (this one on the BizTalk Adapter Pack and LOB SDK).  Besides expecting 14 different blogs on the MSDN site to do nothing but cut and paste the announcement,  this also means that I shouldn’t make fun of the team’s poster-producing prowess ever again.   I’m still holding out hope for the “Women of BizTalk Server” poster.  Fingers crossed.

Technorati Tags: , BizTalk

Author: Richard Seroter

Richard Seroter is Director of Developer Relations and Outbound Product Management at Google Cloud. He’s also an instructor at Pluralsight, a frequent public speaker, the author of multiple books on software design and development, and a former editor plus former 12-time Microsoft MVP for cloud. As Director of Developer Relations and Outbound Product Management, Richard leads an organization of Google Cloud developer advocates, engineers, platform builders, and outbound product managers that help customers find success in their cloud journey. Richard maintains a regularly updated blog on topics of architecture and solution design and can be found on Twitter as @rseroter.

7 thoughts

  1. Nicely explained. I was stuck with the same issue. I could resolve it by modifying my conditions in Rules section. Thanks !

  2. I am pulling what’s left of my hair out and couldn’t seems to get it right. My rule is IF Closure Date is not blank then Closure Plan is not blank and Closure Date must be greater than Open Date.

    Not working under these conditions
    ClosureDate is not blank AND
    ClosurePlan is blank OR
    ClosureDate is not blank AND
    ClosureDate < OpenDate

    Big thanks if anyone can help me with this condition logic.

    1. I saw an earlier post from Hilary Stoupa that recommended you use the ‘expression’ in the condition. This way you can group multiple conditions into a single condition statement.

  3. I have a Rule with 5 AND conditions but they’re treated as OR conditions. If ONE condition becomes TRUE, the field I’m trying to hide is revealed. I don’t want it revealed until all 5 are TRUE. Any ideas for me? Here’s a screenshot of my rule:

    1. Hey Mark. That’s fascinating. I don’t know the answer to that and haven’t experienced it. Does it apply to any condition? If you change any of the 5 does it reveal the field? Or just the first?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.