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.
Nicely explained. I was stuck with the same issue. I could resolve it by modifying my conditions in Rules section. Thanks !
great post. Was going nuts trying to write expressions for more than 5 conditions until I came across this. So simple – use multiple rules. Thank you!!!!
Happy to help!
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.
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.
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: http://i.stack.imgur.com/hx99B.png
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?