Multiple conditionals within a common control - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Multiple conditionals within a common control

Last post 06-04-2012 01:20 PM by workin'stiff. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-04-2012 12:09 PM

    Multiple conditionals within a common control

    Hi everyone,

    I've got an issue where I need to have multiple conditionals (read formatting) within a common control. See my example below.

    Text Box 1 (Integer)
    Text Box 2 (Integer)

    Text Box 1 (e.g. TB1) will contain one of three user entered values - 39,000 / 40,000 / 41,000.

    • If the user enters 39,000 into TB1, the acceptable range for Text Box 2 (TB2) needs to fall within 3500 to 3700.
    • If the user enters 40,000 into TB1, the acceptable range for TB 2 is 3670 to 3870.
    • If the user enters 41,000 into TB1, the acceptable range for TB2 is 3840 to 4040.

    I currently have the conditional formatting set up within TB 2 as follows (each of the items below are a separate conditional):

    1. TB1 is equal to 39,000 AND TB2 is less than 3500 OR TB2 is greater than 3700
    2. TB1 is equal to 40,000 AND TB2 is less than 3670 OR TB2 is greater than 3870
    3. TB1 is equal to 41,000 AND TB2 is less than 3840 OR TB2 is greater than 4040

    The problem is that only the first set of conditional formatting is being applied to TB2, regardless of the value within TB1. Am I misinterpreting the funcitonality of the AND within setup of the conditional formatting?

    Let me know if I need to provide additional clarification.

    Thanks in advance!
    Tom

  • 06-04-2012 12:20 PM In reply to

    Re: Multiple conditionals within a common control

    I have a feeling that the issue here is the associativity of AND and OR.  AND has a higher precedence than OR, so in this case, what you're actually getting is:

    1. [TB1 is equal to 39,000 AND TB2 is less than 3500] OR TB2 is greater than 3700
    2. [TB1 is equal to 40,000 AND TB2 is less than 3670] OR TB2 is greater than 3870
    3. [TB1 is equal to 41,000 AND TB2 is less than 3840] OR TB2 is greater than 4040

    I'd suggest either splitting this out into 6 conditions:

    1. TB1 is equal to 39,000 AND TB2 is less than 3500
    2. TB1 is equal to 39,000 AND TB2 is greater than 3700
    etc.

    or you can use 3 exceptions, but have the OR part entered on a single line, as a manually-entered condition:

    1. TB1 is equal to 39,000 AND
        (TB2 is less than 3500 OR TB2 is greater than 3700)
    etc.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-04-2012 01:20 PM In reply to

    Re: Multiple conditionals within a common control

    I ended up splitting everything into six separate conditions. And it worked like a champ!

    Sometimes it all about the KISS concept.

    Thanks for the help!
    Tom

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