Delete just one section of repeating section? - InfoPath Dev
in

InfoPath Dev

Delete just one section of repeating section?

Last post 08-26-2011 10:22 AM by shniggens. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 08-25-2011 03:38 PM

    Delete just one section of repeating section?

    In another form, I use the delete command in a repeating table, and it automatically just deletes the row that the button that runs the command is in.

    However, in this form, I have the same button in a repeating section, and it deltes the whole section (IE, mulitiple sections if they have been added).  Is there a way to filter it just to delete the current section?

  • 08-25-2011 03:57 PM In reply to

    Re: Delete just one section of repeating section?

    What are you setting the command field to in your rule? Click the Edit XPath checkbox prior to copying and pasting.

    Hilary Stoupa

  • 08-25-2011 06:01 PM In reply to

    Re: Delete just one section of repeating section?

    This is what I'm using

    Delete /xpath=/my:myFields/my:Venues/my:VenueRepeatingSection

    It deletes every instance of my repeating section.

  • 08-25-2011 08:39 PM In reply to

    Re: Delete just one section of repeating section?

    I would presume you have something similar to this in your other form as well, but the expression would be something like:

    concat("Delete /xpath=/my:myFields/my:Venues/my:VenueRepeatingSection[", count(preceding-sibling::my:VenueRepeatingSection) + 1, "]")

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-26-2011 07:03 AM In reply to

    Re: Delete just one section of repeating section?

    No, I don't have that in my other form.  Does it have something to do with the other form being a repeating table, not a section? 

    Thanks for that.  I will give it a whirl. 

  • 08-26-2011 08:32 AM In reply to

    Re: Delete just one section of repeating section?

    What's the formula in your other form like? It doesn't matter if you have a repeating section control or a repeating table control bound to your repeating group - the underlying data structure would be the same.

    Hilary Stoupa

  • 08-26-2011 08:50 AM In reply to

    Re: Delete just one section of repeating section?

    The formula just consists of the delete command with the xpath to the repeating table.  Wierd.

    Another question.  Now that the delete works (thanks), how do I format that button to be disabled if there is no second section present?  IE, I don't want users to delete the only section existing in the form.

  • 08-26-2011 09:03 AM In reply to

    Re: Delete just one section of repeating section?

    In the conditional formatting, try the expression:

    count(following-sibling::my:VenueRepeatingSection) = 0

    Hilary Stoupa

  • 08-26-2011 09:35 AM In reply to

    Re: Delete just one section of repeating section?

    That disables it permanently, no matter how many sections are added. 

  • 08-26-2011 09:40 AM In reply to

    Re: Delete just one section of repeating section?

    Sorry - how about:

    count(my:myFields/my:Venues/my:VenueRepeatingSection) = 1

    Just count all instances and if there is only one, disable.

    Hilary Stoupa

  • 08-26-2011 09:54 AM In reply to

    Re: Delete just one section of repeating section?

    Thanks,

     I got it to work with - count(../my:VenueRepeatingSection) = 1

     Now I have to figure out how to disable a button if a following section is present.

  • 08-26-2011 10:12 AM In reply to

    Re: Delete just one section of repeating section?

    In other words, you want the button to only be enabled on the last section?  If so, I believe the expression would be:

    count(following-sibling::my:VenueRepeatingSection) != 0

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-26-2011 10:22 AM In reply to

    Re: Delete just one section of repeating section?

    Yes!  That's great!  I'm learning a lot about the siblings these days. 

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