Instances of a Repeating Section based on Field Value - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Instances of a Repeating Section based on Field Value

Last post 08-22-2011 08:59 AM by Lockdown. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 08-19-2011 09:01 AM

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Instances of a Repeating Section based on Field Value

    Hi,

    Is it possible to create 'x' instances of a repeating section based on a number stored in a field?

    ie. 5 in 'numberOfSections' results in 5 instances of Section

    Erich

  • 08-19-2011 11:14 AM In reply to

    Re: Instances of a Repeating Section based on Field Value

    Hello Erich,

    InfoPath doesn't have any built-in functionality to do this, but it's a piece of cake with qRules.  You can just concatenate the number into the Insert command:

    concat('Insert /parent=parentXpath /child=childXpath /count=', numberOfSections)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-19-2011 12:31 PM In reply to

    Re: Instances of a Repeating Section based on Field Value

    You can do something like this as a work around:

    Conditional formating -> The expression -> "position() > numberOfSections" -> Hide This Section.

    Use this form as a reference. They use a dropdown list to change some values, but i dont see why you couldn't do it with a text box.

     http://blogs.msdn.com/b/infopath/archive/2006/09/09/748003.aspx

  • 08-19-2011 12:56 PM In reply to

    Re: Instances of a Repeating Section based on Field Value

    Also, you will need add the maximum number of sections allowed to the default values. If the max number is way too big then this may not be very effiecient.

    Tools -> Default Values -> find your group and click on the dropdown on the right -> Add another Group below.

    This should do the trick, let me know if this works for you or not.

  • 08-22-2011 06:43 AM In reply to

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Re: Instances of a Repeating Section based on Field Value

    Lockdown,

    I just have one problem, for 'position() > numberOfSections', what is the correct syntax for numberOfSections?

    For example, if in javascript I would extract it as XDocument.DOM.selectSingleNode("my:myFields/my:numberOfSections") what would it look like in the condition?

    Erich

  • 08-22-2011 08:38 AM In reply to

    Re: Instances of a Repeating Section based on Field Value

    It would just be the Xpath for that element: /my:myFields/my:numberOfSections.

    Just copy this for your conditional expression: position() > /my:myFields/my:numberOfSections

  • 08-22-2011 08:58 AM In reply to

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Re: Instances of a Repeating Section based on Field Value

    Worked like a charm,

    Thanks for your help!

  • 08-22-2011 08:59 AM In reply to

    Re: Instances of a Repeating Section based on Field Value

    Not a problem! Glad to help.

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