Rules on fields in a repeating section - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Rules on fields in a repeating section

Last post 09-04-2009 04:23 PM by Jimmy. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 09-02-2009 12:38 PM

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Rules on fields in a repeating section

    I have a field in a repeating section that I need to create a rule on.  I need the condition to check the value for all occurrences of that field, like this:

    •  gpRepeatingSection (repeating section)
      • TriggerValue (combo box - yes/no)
    • ResultValue (combo box - yes/no)

    If all occurrences of TriggerValue = no then ResultValue needs to equal no.  If any occurrence of TriggerValue = yes then ResultValue needs to equal yes.

    The problem is when creating the rule I am not being given the option of selecting 'all occurrences of TriggerValue' or 'any occurrence of TriggerValue', I'm guessing because the rule is on a field within that repeating section.  Any ideas?

  • 09-02-2009 10:23 PM In reply to

    Re: Rules on fields in a repeating section

    refer to this link to use eval function on your repeating section http://www.infopathdev.com/forums/t/13133.aspx then just check if the evaluate value contains "yes" or not and set value accordingly

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-04-2009 06:10 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    The problem is the rule needs to be set on one of the fields inside the repeating section and I'm not being given the option when I select the Condition field of specifying "All occurrences of <field>".  I have found a solution, but I'm not sure it's the best solution.  I have created a field on a hidden view and used it to do the checking...

    • gpRepeatingSection (repeating section)
      • TriggerValue (combo box - yes/no)
    • ResultValue (combo box - yes/no)
    • CheckingField (text box)

    Rule on TriggerValue - Condition: None - This rule always applies  Action: Set the value of CheckingField = concat(CheckingField, "1") - this just triggers the rules on CheckingField any time the value of TriggerValue is changed

    2 Rules on CheckingField - (1) Condition: All occurrences of TriggerField != 'Yes'  Action: Set the value of ResultValue = 'No'  (2) Condition: Any occurrence of TriggerField = 'Yes'  Action: Set the value of ResultValue = 'Yes'

    This works correctly, but I'd be interested to know if there's a simpler solution.

  • 09-04-2009 06:56 AM In reply to

    Re: Rules on fields in a repeating section

    Isn't this the same issue that you mentioned in your other thread?

    Re: Setting a field value inside a hidden section

    If so, I suggested a solution there.  Did you try it?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-04-2009 07:32 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    Yea, I posted a different thread because it was a different issue than I originally thought, having nothing really to do with the target being in a hidden section.  I didn't really understand your post when I first looked at it (moderate level of programming experience but fairly new to InfoPath).  I took another look at it and the lights went on.  I will try it in my test environment and let you know how it comes out.

  • 09-04-2009 07:41 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    Wait, this won't work.  Placing this in the rules on the ResultValue field, the rule won't be triggered when the TriggerValue field is changed.

  • 09-04-2009 09:02 AM In reply to

    Re: Rules on fields in a repeating section

     Then put the rule on the TriggerValue field.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-04-2009 09:07 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    That's the problem.  If I put the rule on the TriggerValue field it does not allow me to specify "All occurrences of TriggerValue" as a condition, I'm guessing because it's actually inside the repeating section.

  • 09-04-2009 09:09 AM In reply to

    Re: Rules on fields in a repeating section

     Did you read my post?  I didn't suggest that you use "All occurrences of TriggerValue."  I suggested an alternative.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-04-2009 09:32 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    Of course I read your post.  I'm very sorry, I wasn't thinking and should have taken more time with my last post - doing too many things at once.  What I wasn't seeing is the option "The expression" under the first field in the Condition dialog box. Like I said, still fairly new to InfoPath.  I'll take another shot at this and let you know how it comes out.  Thanks for being patient with me.

  • 09-04-2009 10:14 AM In reply to

    • g-man
    • Not Ranked
    • Joined on 08-25-2009
    • Posts 12

    Re: Rules on fields in a repeating section

    Success!  Here are the specifics in case anyone encounters the same issue.  On the TriggerValue field create two rules:

    • Rule1
      • Condition dialog:
        • First combo box: "The expression"
        • Expression: "not(//my:myFields/..../my:TriggerValue[. != 'No'])"
      • Action dialog:
        • First combo box: "Set a field's value"
        • Field: "ResultValue"
        • Value: "No"
    • Rule2
      • Condition dialog:
        • First combo box: "The expression"
        • Expression: "boolean(//my:myFields/..../my:TriggerValue[. = 'Yes'])"
      • Action dialog:
        • First combo box: "Set a field's value"
        • Field: "ResultValue"
        • Value: "Yes"

    Thanks again Jimmy for all your help and patience.

  • 09-04-2009 04:23 PM In reply to

    Re: Rules on fields in a repeating section

     Awesome.  Glad to hear you figured it out, and thanks for sharing your final solution in an easy-to-read format so that it can help others.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.