Can you remove repeating sections using code - InfoPath Dev
in

InfoPath Dev

Can you remove repeating sections using code

Last post 10-14-2009 01:10 PM by Hilary Stoupa. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-13-2009 07:43 PM

    • moggy
    • Top 150 Contributor
    • Joined on 06-22-2009
    • New Zealand
    • Posts 62

    Can you remove repeating sections using code

    I have a form with a drop down box which hides/shows a repeating section.

    When it shows, the user can add new sections to it in the normal manner.

    If the user changes their minds and changes the value in the drop down to something else. The section gets hidden, however the data would still persist in the form if not viewable in this current view.

    I would like to removed the sections that the user added before changing their minds. Can this be done with rules, or would it have to be with code?

  • 10-13-2009 08:03 PM In reply to

    Re: Can you remove repeating sections using code

     How to clear a repeating section using rules:

    1. Create a new rule wherever it needs to be when you want to clear the repeating section, and add any conditions that you want.
    2. Set the rule to set the field value of one of the child fields (any one of them) of the repeating group to a blank value.
    3. Save your form as its source files and close InfoPath.
    4. Open the manifest.xsf file in a text editor and locate the <xsf:rule> node that corresponds to your new rule.  It'll look something like this:
      <xsf:rule caption="Rule 1" isEnabled="yes">
                      <xsf:assignmentAction targetField="my:group1/my:group2/my:field1" expression="&quot;&quot;"></xsf:assignmentAction>
      </xsf:rule>
    5. Modify the targetField value so that it references the parent of your repeating group:
      <xsf:rule caption="Rule 1" isEnabled="yes">
                      <xsf:assignmentAction targetField="my:group1" expression="&quot;&quot;"></xsf:assignmentAction>
      </xsf:rule>
    6. Re-save the manifest.xsf and re-open it in design mode.
    Note that this will remove everything below the parent of the repeating group, so you should design your data source so that that node doesn't have any other children.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-14-2009 12:39 PM In reply to

    • moggy
    • Top 150 Contributor
    • Joined on 06-22-2009
    • New Zealand
    • Posts 62

    Re: Can you remove repeating sections using code

    Great thanks quys. Will try the last one first.

     

    Regarding editing the manifest file. Is there some comprehensive documentation out there on this. The books I have mention it is there and how to access it, but that is about it. Some stuff in it is obvious, but not everything.

  • 10-14-2009 01:10 PM In reply to

    Re: Can you remove repeating sections using code

    This MSDN link is my best friend. Which is sort of sad.

    Hilary Stoupa

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