Insert Item in a repeating section - InfoPath Dev
in

InfoPath Dev

Insert Item in a repeating section

Last post 10-08-2009 06:16 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-08-2009 02:58 AM

    Insert Item in a repeating section

    Hi everyone,

    Please could you assist me in the following.:

    I have a form on InfoPath that adds a new request for Change to a Back end Access Database. On the database there is a subform which shows the comments made by relevant people as the form is progressed through different departments. For example I have the created request number R-13. in the subform you can add comments like "This is Acknowledged by catering", and the date the entry took place. Then the chefs can look at it and put another line in the subform such as "This is acknowledged by Chefs". It works fine in Access but I am having a problem in InfoPath.

    I have got the repeating table in InfoPath which shows the Rows of data in the subform that are linked to the main data source working fine. I can Also add new lines of comments, underneath. I dont like the Cut, Copy, and Paste option that comes with it though. What I wanted to do was have a button which enters a new line of text in the subform. That way I can ask the user to enter their comment in an unbound text box on InfoPath, and get a button to transfer this comment into a new line on the subform. Is there any way to do this.

     I have tried already but obviously creating a button that sets a fields value (field being the comment field in the subform) to "This is Acknowledged", then overwrites all of the lines of the subform with that value.

    Please help

    Keith

    Filed under:
  • 10-08-2009 06:16 AM In reply to

    Re: Insert Item in a repeating section

     To answer your questions:

    1.  You can use qRules' Insert command to insert rows into a repeating section using rules.  Then you can turn off the "Allow users to insert/delete rows" option in the repeating section.

    2.  Unbound controls are essentially useless.  If you don't want the comment input field in your main data source, you can create a simple XML file, like:

    <?xml version="1.0" ?>
    <formLogic>
       <comment></comment>
    </formLogic>

    and import this as a secondary data connection, then use a textbox bound to the comment field.

    3.  Using rules to copy a value into a single row of a repeating section requires a little bit of tricky maneuvering.  Hilary Stoupa's blog explains how to do it.  Where she uses something like:

     my:items/my:baseCost[../my:itemType='Labor']

    to select a row with a certain value in one of its fields, you can use the last() function like:

    prefix:repeatingGroup[last()]/prefix:comment

    (using the correct node names of course) to modify the comment field in the last (most recently added) row.

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