Hide Rule on Section Converts to Two Rules - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Hide Rule on Section Converts to Two Rules

Last post 08-30-2012 06:01 PM by Hilary Stoupa. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-17-2012 10:20 PM

    Hide Rule on Section Converts to Two Rules

    Hi All,

    I am using InfoPath 2010 and have a form that has two fields and a section.

    I want to hide the section when field1 <> 0 or (field1 = 0 and field 2 <> “Initiator”) I called my rule “Hide Section” and the conditions in my rule were…
    • field1    is not equal to     0     or
    • field1    is equal to           0     and
    • field2    is not equal to    “Initiator”
     When I save my form then re-open it, my rule has been converted to two rules. The “Hide Section” rule now has the condition…
    • field1    is not equal to     0      
    and there is a second rule called “Rule 1” which has the conditions…
    • field1    is equal to           0     and
    • field2    is not equal to    “Initiator”
    Is there any way to keep all the conditions in one rule?(I eventually want to add many more sections to the form and it will be easier to copy one rule rather than two to all the sections)

    Thanks! 

  • 07-18-2012 05:03 AM In reply to

    Re: Hide Rule on Section Converts to Two Rules

    Well, luckily, in InfoPath 2010, you can click this button (screenshot attached) in the Rules taskpane and copy all rules. Then click Paste next to it to paste all rules.

    So even if InfoPath keeps splitting your rule into two, you can still copy/paste in easy steps.

    Good luck!


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 07-18-2012 05:18 PM In reply to

    Re: Hide Rule on Section Converts to Two Rules

     

    I still have the problem though that when I write a rule and give it a meaningful name, that name may not apply anymore when InfoPath moves half of my conditions into other rules.

     

    Is there a reason why InfoPath does this and in what cases will InfoPath change your rules?

    If I knew I could avoid creating rules that InfoPath doesn't like.

     

    Thanks

  • 08-28-2012 08:00 PM In reply to

    Re: Hide Rule on Section Converts to Two Rules

     

    After investigation, it appears that infopath will split any hide rule on a section that contains  a combination of "and" and "or" conditions.

    If the conditions are all "and" or all "or" , InfoPath won't split the hide rule.

    If the hide rule is on a field and contains a combination of "and" and "or" conditions, InfoPath will not split the hide rule.

    Seems inconsistent that this only happens with hide rules on sections (not fields).

    Either InfoPath should not split your rule without some sort of notification or it shouldn't allow you to enter a combination of "and" & "or" condtions on a rule to hide a section.

  • 08-29-2012 06:30 AM In reply to

    Re: Hide Rule on Section Converts to Two Rules

    InfoPath 2010 (at least on my machine) does split the rules on fields (not just on sections).

    If you have a combination of "and" and "or" conditions, I think InfoPath won't split it to respect the possible complexity of the condition's logic.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 08-29-2012 05:21 PM In reply to

    Re: Hide Rule on Section Converts to Two Rules

    In regards to the previous statement "If you have a combination of "and" and "or" conditions, I think InfoPath won't split it to respect the possible complexity of the condition's logic.", Infopath does split the rule and that is my exact problem. I don't just think InfoPath will split the rule, I have tested this and it does occurr.  I am using an InfoPath 2010 browser enabled form.

     I created a rule called "Hide when A and B or AB".

    The rule is for hiding a control, the conditions are very basic - field1 = "A" and field2 = "B" or  field3 = "AB"

    I put the same rule on a section and a field.  I then save the form, and re-open it.

    The rule on the section is split - the first rule is called "Hide when A and B or AB" and contains only the conditions field1="A" and field2="B", and the one InfoPath very kindly (not) creates is called "Rule 1" and has the condition field3= AB.

    The rule on the field has not changed and still contains all three conditions.

     

  • 08-30-2012 07:53 AM In reply to

    Re: Hide Rule on Section Converts to Two Rules

    But splitting this - while inconvenient for you - doesn't affect the logic. Your initial rule (or at least the way IP interprets it) is:

    (field1 = "A" and field2 = "B") or field3 = "AB"

    When the rule is split, the logic is the same. Is the problem just that this is inconvenient? I agree it seems like inconsistent application behavior and is a little annoying - I'd noticed rules being split before but just hadn't paid attention to the circumstances.

    Hilary Stoupa

  • 08-30-2012 04:45 PM In reply to

    Re: Hide Rule on Section Converts to Two Rules

     

    It is very inconvenient if you have a large number of rules and take the time to give them meaningful names.

    As soon as you save and re-open your form, you have to go and rename all the rules you have previously created and all the new rules InfoPath has created.

    It is handy and saves time if you know under what circumstances InfoPath does this, so you avoid it occuring.

  • 08-30-2012 06:01 PM In reply to

    Re: Hide Rule on Section Converts to Two Rules

    That makes sense - like I said, I've seen this, but hadn't really tried to track down when it happened (and may have seen it and just thought I'd managed to forget to name a rule...). Thanks for posting the info on when you are seeing it happen - now others won't think they are forgetful when it is just dear old InfoPath "helping" out. :-)

    Hilary Stoupa

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