How can I collapse/expand a repeating section - InfoPath Dev
in

InfoPath Dev

How can I collapse/expand a repeating section

Last post 02-11-2013 08:39 AM by nkstrou. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 12-04-2012 01:41 PM

    How can I collapse/expand a repeating section

    I am using infopath 2010. I have a fairly large repeating section. I want to collapse it and expand. Is it possible? if not, any other ideas are welcome.

     

    svallab

  • 12-04-2012 07:56 PM In reply to

    Re: How can I collapse/expand a repeating section

    Are you looking to use expand/collapse on the individual rows, or show/hide the whole thing?  If it's the latter, and you're already familiar with how to do show/hide on a non-repeating section, I'd say put the whole repeating section in a section control and show/hide that.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-05-2012 04:54 AM In reply to

    Re: How can I collapse/expand a repeating section

    Thanks for the response. I am looking for expanding or collapsing each instance of the repeating table.

  • 01-15-2013 05:45 PM In reply to

    Re: How can I collapse/expand a repeating section

     InfoPath won't let you collapse/expand a repeating table, but you can show/hide each instance of it.  Depending on whether you also need to hide some of the text associated with your repeating tables, you can either put a formatting rule directly on the repeating table and hide that under certain conditions, or else you can create a smaller section within your large section and put some of the text from the large section in there along with one of your repeating tables and put your formatting rule on the smaller section to show/hide that.

     If you meant to say that you are looking to expand/collapse each instance of a repeating section instead of a repeating table, you can still do that.  I'd probably put a button called Show/Hide Section at the bottom of the repeating section control and a textbox called txtHideSection, which I would add a formatting rule to always hide (I use the condition 1=1 for that - because it will always evaluate to true) and set to No by default.  Then I'd put a formatting rule on the repeating section and set it to hide whenever txtHideSection is Yes.  Then I'd put 2 action rules on my button as follows:

    1. If txtHideSection is not Yes (i.e. blank or No), set txtHideSection to Yes (and stop running any more rules - there should be a checkbox for that -if you don't set this, both rules will always run and txtHideSection will always be No - and therefore never hidden)
    2. If txtHideSection is Yes, set txtHideSection to No.

    That should cause the button to act like a toggle to show/hide your repeating section.  You can use this same principle to show/hide repeating tables.

     Good luck!

    nkstrou

     
    An imprecisely defined requirement has an infinite number of possible solutions. Unfortunately, only about a maxiumum of 3 solutions are actually satisfactory to the end user.
  • 01-15-2013 06:14 PM In reply to

    Re: How can I collapse/expand a repeating section

     Oh wait a sec...if you do that, your button will be hidden when txtHideSection is Yes and you won't be able to toggle it back to Show.  I'm not sure offhand how to get separate Show/Hide buttons for each instance of the repeating section and not have them get hidden.  You could create a section and put the repeating section in that and the button and txtHideSection in the section but not the repeating section, but then the button will show/hide ALL instances of the repeating section and not individual instances.   I don't know if that would work for you or not.

    Sorry for the confusion...

    nkstrou

    An imprecisely defined requirement has an infinite number of possible solutions. Unfortunately, only about a maxiumum of 3 solutions are actually satisfactory to the end user.
  • 01-15-2013 06:54 PM In reply to

    Re: How can I collapse/expand a repeating section

     OK, to have a Show/Hide button for each instance of the repeating section, you start off by creating a repeating section, then put two regular sections in that.  Into the first section, you put the controls from your large repeating section, in essence turning it into a non-repeating section (don't freak out, the fact that the section is located in a repeating section will still give you the repeating section effect).   Then add the Show/Hide button and txtHideSection to the 2nd regular section and set up the buttons and textbox as described above.  Add the formatting rule that hides the section to your first (large) section.

     Good luck!

    nkstrou

    An imprecisely defined requirement has an infinite number of possible solutions. Unfortunately, only about a maxiumum of 3 solutions are actually satisfactory to the end user.
  • 02-11-2013 06:14 AM In reply to

    Re: How can I collapse/expand a repeating section

    Just a little expansion on this. I found this method helpful and implemented it, so thanks. But I then changed it a little bit and thought I would share. In my "collapsed" section I wanted a few of the data fields from the "expanded" section. Rather than using the same button, I implemented a button for each. On the expanded section, I added a hide button that changed the field value for txtHideSection to Yes. On the collapsed section, I added a show button that set txtHideSection to No. I followed this up with conditional formatting on the collapsed section that if txtHideSection is set to no, then hide the section. This way, both sections are not visible at the same time. Additionally, and this may not apply to more experienced Infopath developers, on the repeating section, be sure to set the height to auto so when the form collapses you don't have extra canvas space.

    Jeffrey A. Tibbetts
  • 02-11-2013 08:39 AM In reply to

    Re: How can I collapse/expand a repeating section

     Thanks for posting.  It's always interesting to me to hear how a basic idea can be varied to meet a slightly different requirement.  Here's to hoping somebody else stumbles across this post one day and finds it useful!  :)

     nkstrou

    An imprecisely defined requirement has an infinite number of possible solutions. Unfortunately, only about a maxiumum of 3 solutions are actually satisfactory to the end user.
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.