Copy rows of a repeating table to another repeating table using a check box - InfoPath Dev
in

InfoPath Dev

Copy rows of a repeating table to another repeating table using a check box

Last post 10-04-2016 07:12 AM by Rehab. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 04-24-2013 10:05 AM

    Copy rows of a repeating table to another repeating table using a check box

    Hello.  This is my first post so I hope the format is correct.  I have been spinning my wheels for the last three weeks trying to figure out how to copy rows of data from one repeating table to another repeating table.  I would like to click a check box and have the corresponding row  populate a second repeating table.  I am not a "code" person so the littlest amount possible would be great.  Thanks for help, in advance.

     

  • 04-24-2013 04:25 PM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

     Hi - This is just one of those things in InfoPath that requires code, unfortunately, and it is hard to provide a generic example when the schemas in your form will likely vary quite a bit from any sample I can come up with.

    That said, give this blog post a try, or try out the trial of qRules (which would allow you to not have to write your own code at all).

    Hilary Stoupa

  • 04-26-2013 07:52 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Hilary, thank you for the very quick response.  Can you suggest an alternate approach to doing what I need the form to do?  I need to be able to maintain the integrity of the database connection while having the ability to write new records without having the user manually add each record.

    Thank you - Chad

  • 04-26-2013 07:59 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

     So, can you tell me more about the architecture here? You mention database integrity - so is this a database bound form?

    Hilary Stoupa

  • 04-26-2013 11:07 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Hilary,

     This is a database form (call it Master).  I have added a text box with a rule that says "when value = Edit" the query runs against the database and allows the user to update and save the changes to the existing master database table. The second part is "If the text box says Add" then allow the user to write the new data to the Mastert database table.  I hope this helps a little.  I am normally told not to be so detail oriented so I am trying not to give more information than you may need. 

     Thank you again for your help.  I am going into 4 weeks on this form and feel like I am not getting anywhere.

     Chad

  • 04-26-2013 11:31 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Is there a way to send two screen shots to you?

  • 04-26-2013 11:50 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

     You can attach them under the Options tab in a reply. It will be later in the day before I'll have time to take a look at this. :)

    Hilary Stoupa

  • 04-26-2013 11:54 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Great!  Thank you.  - Chad


  • 04-26-2013 02:20 PM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Chad if you can post your xpath schema I can help you with the code... just finished doing something similar.  At a high level in your code behind:

    1. Confirm you have items to copy.

    2. Make sure destination is empty (empty if not by a sub-method that will iterate over children and deleteself() on each child).

    3. Node iterator over source RT.

    4. Extract values and build up xmldocument of destination RT and then AppendChild() to add XmlDocument as a row in the new Dest repeating table.

    Few gotchas... in the destination RT, you MUST adhere to the schema strictly (sequence, sub-rows etc.), and lookout for nulls of primitive datatypes as required.  I gave up on trying to have a highly nested schema as it was a real chore to try to build up my new DOM, instead I oped for a single depth level (my:group/my:innergroup - innergroup is the rows in RT that repeat).

    Hope this helps,

    Rob

  • 04-27-2013 06:45 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

     Does your form submit just to a SQL database? That is, you don't save the XML anywhere? If so, it may be possible to do what you need w/ very limited or no code, depending on how much work is acceptable for the users. One option would be to use default values for the main data source fields that get their info from the 2ds - if your form just submits to SQL (or Access), then you shouldn't have to worry about whether the 2ds values change (you won't be re-opening an XML later and having incorrect or missing data). From there, you could either let the user click insert on the main table (for no code), or you could use something like this suggestion from Jimmy (for very limited code) to just add the rows and let the default values populate the data.

    Hilary Stoupa

  • 04-27-2013 05:01 PM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Here's a simple sample I blogged in 2011 that shows the technique Jimmy and Hilary are referring to (in addition to the qRules technique) - both techniques require zero coding.

    http://www.infopathdev.com/blogs/patrick/archive/2011/09/03/free-sample-copying-repeating-data.aspx

    Patrick Halstead
    Project Manager at Qdabra
  • 04-29-2013 07:38 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

     Rob,

    Thanks for the response and sorry for my delay.  I was out for the weekend visiting the kids.

    Here are my xpath schemas.  I would like to enter data into the Secondary Source (/dfs:myFields/my:Copy/my:CopyFrom) and have it copy to the Main Source (/dfs:myFields/dfs:dataFields/d:POG_MasterList_InfoPath) so I can submit the information back to the Access Database

    Data Fields for the Main Source (Access table - Read/Write)

    • /dfs:myFields/dfs:dataFields/d:POG_MasterList_InfoPath 

     

    Data Fields for the Secondary Source (Access Table - Read Only) 

    • /dfs:myFields/my:Copy/my:CopyFrom

    Thank you - Chad

  • 04-29-2013 08:37 AM In reply to

    Re: Copy rows of a repeating table to another repeating table using a check box

    Hilary,

    The form only submits to an Access database.  I will try each of the suggestions you have made.

    Chad

  • 10-04-2016 07:12 AM In reply to

    • Rehab
    • Not Ranked
    • Joined on 09-29-2014
    • Posts 6

    Re: Copy rows of a repeating table to another repeating table using a check box

     Hi dear,

          I need your help. I've 2 views for infopath form (original and updated). I've a repeating table in the original one, i need it to be copied in updated view but the issue is I need to keep the original one as is but the copy operation makes that impossible as any change in the updated one reflects in the original one. I need to copy the original in the updated and keep any changes in the table in the updated only.

    Is that possible?!

    Thanks in advance,

    Rehab,

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