Or operator not working in Hide formula - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Or operator not working in Hide formula

Last post 07-29-2013 08:36 AM by Ghoztrider. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-10-2013 07:26 AM

    Or operator not working in Hide formula

     Hi,

     

    Is it just me or does the "or" operator not work at all when using it to hide an element in Infopath 2010 when using rules. For instance.......

    If "Last Name" = "Jimbob" OR

    If  "Last Name" = "MarySue" Then Hide element

      If rule 1 is false and rule 2 is true it stops at rule 1. This is a formatting rule of course. Am I missing something really really simple here? Thanks.

     

  • 07-10-2013 01:03 PM In reply to

    Re: Or operator not working in Hide formula

    IMHO -  Sometimes. I think InfoPath doesn't play nicely when you combine OR and Ands in the same condition. I'm convinced that sometimes I have to write my rule almost backwards to get it as I want.

    Sometimes I've put two separate rules on a control instead of combining them.

    Also you could add a dummy text field so that you can check your result output.You could use the dummy field also in a rule.

  • 07-11-2013 04:07 AM In reply to

    Re: Or operator not working in Hide formula

    In all my time with InfoPath, I can't say I've encountered an issue with OR working unexpectedly. When you say "If rule 1 is false and rule 2 is true it stops at rule 1." Are you using one rule or two rules? If it's two, then are you actually using the OR operator? What is your expected behavior in this case? How have you verified that, as you say, it stops at rule 1?
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-11-2013 04:10 AM In reply to

    Re: Or operator not working in Hide formula

    wilkies0106aw:
    I think InfoPath doesn't play nicely when you combine OR and Ands in the same condition.

    XPath and most programming languages give AND a higher precedence than OR (and InfoPath uses XPath behind the scenes). This means that this expression:

    Field1 = "a" OR Field2 = "b" AND Field3 = "c" OR Field4 = "d"

    Is equivalent to:

    Field1 = "a" OR (Field2 = "b" AND Field3 = "c") OR Field4 = "d"

    Perhaps this is the cause of the behavior you have experienced?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-29-2013 08:36 AM In reply to

    Re: Or operator not working in Hide formula

     Here is a simple rule that won't play nicely with me.......

     

    Scenario:

    Comments: multiple lines of text

    Status: radio button (4 choices, two being Unapproved and Declined)

     

     Formatting rule on Comments Control > If "Status" IS NOT EQUAL to "Unapproved" OR If "Status" IS NOT EQUAL to "Declined" Then hide the comments control

     

    I've set this rule up with an OR operator between the two choices and as two separate rules (one rule for each status) and neither one works. I set up a rule with only one status(Unapproved) and it works flawlessly. This is a browser enabled form. This seems like it should be a fairly easy.....

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