Copy text from one repeating table to another - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Copy text from one repeating table to another

Last post 07-29-2011 07:36 AM by ChuckP. 49 replies.
Page 4 of 4 (50 items) < Previous 1 2 3 4
Sort Posts: Previous Next
  • 03-02-2010 09:15 PM In reply to

    Re: Copy text from one repeating table to another

    Hey Greg,

     I tried writing the code per your suggestion however it is returning only first row, here is the code, can you please help ?

    XDocument.GetDOM("Tran Type Generated").setProperty("SelectionNamespaces", 'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-10-20T16:02:22"');
    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-10-20T16:02:22"');

    // Get a copy of the main DOM node.
    var clone = XDocument.DOM.selectSingleNode("/my:TTFields/my:group7/my:group8").cloneNode(true);

    // Clear the main DOM nodes.
    XDocument.DOM.selectNodes("/my:TTFields/my:group7/my:group8").removeAll();

    // Copy nodes from 2DS to main DOM.
    var node;
    var nodes = XDocument.GetDOM("Tran Type Generated").selectNodes("/dfs:myFields/dfs:dataFields/dfs:Tran_Type_Generated"); // Note: need to supply the correct namespace per element in this XPath.
    XDocument.UI.Alert(nodes.length);
    var row;
    //for (i=0; i< nodes.length; i++)
    while (row = nodes.nextNode())
      {
          clone.selectSingleNode("/my:field1").text = row.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Tran_Type_Generated/@Checklist__").text;
       clone.selectSingleNode("/my:field2").text = row.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Tran_Type_Generated/@Source").text;
       clone.selectSingleNode("/my:field37").text = row.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Tran_Type_Generated/@Transaction_Type_Description").text;
     
     XDocument.DOM.selectSingleNode("/my:TTFields/my:group7").appendChild(clone.cloneNode(true));

      }

  • 03-03-2010 07:24 PM In reply to

    Re: Copy text from one repeating table to another

    Found the answer, when I used "getAttribute" it worked just fine, following is an example:

    clone.selectSingleNode("/my:field1").text = nodes(i).getAttribute("Checklist__")

  • 10-05-2010 05:10 AM In reply to

    Re: Copy text from one repeating table to another

     I have same issue copy from one repeating table to another but with condition (i.e if condition satisfied particular data should seen in another repeating table)

     

    thanks in advance.........if 1 can help

  • 10-05-2010 02:06 PM In reply to

    Re: Copy text from one repeating table to another

    Hi Sanjay,

    This is an old thread. Nowadays, we recommend people use qRules to copy from one table to another. It's very easy to do. Jo-Anne's recent blog describes the technique of using insert and rules to do this: http://www.infopathdev.com/files/folders/qrules/entry58577.aspx. We're going to be posting another document in the next week that discusses how to do nested repeating sections, but it's essentially the same technique of using qRules Insert row along with rules. No code required but you will need the qRules plugin.

    Patrick Halstead
    Project Manager at Qdabra
  • 07-29-2011 07:36 AM In reply to

    • ChuckP
    • Not Ranked
    • Joined on 07-25-2011
    • Posts 4

    Re: Copy text from one repeating table to another

    Greg,

    I have a similar issue. I am using VB and would like to do the same thing; However, my repeating table is using conditional formatting as the filter and pulls in all of the records from a sharepoint list.
    There are 5 fields with duplicate values in 2 of them. The conditional format unhides only those records that are relevant to the search.
    Search Fields below

    Discipline
    Test
    Phase
    Begin

    Form Code:
    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup

    AddHandler EventManager.XmlEvents("/dfs:myFields/dfs:dataFields/dfs:Level_1_Adoption_Dump/@Level_1", "Level 1 Adoption Dump").Changed, AddressOf Level_20_1_20_Adoption_20_Dump__Level_1_attr_Changed

    AddHandler EventManager.XmlEvents("/my:myFields/my:Discipline").Validating, AddressOf Discipline_Validating

    AddHandler EventManager.XmlEvents("/my:myFields/my:Discipline").Changed, AddressOf Discipline_Changed

    AddHandler EventManager.XmlEvents("/my:myFields/my:field1").Changing, AddressOf field1_Changing

    AddHandler EventManager.FormEvents.Submit, AddressOf FormEvents_Submit AddHandler EventManager.XmlEvents("/dfs:myFields/dfs:dataFields/dfs:Level_1_Adoption_Dump/@Level_1", "Level 1 Adoption Dump 2").Changed, AddressOf Level_20_1_20_Adoption_20_Dump_20_2__Level_1_attr_Changed

    End Sub
    Repeating Table Below:

     

     

    Level Eval
    1 a
    2 b
    3 c
    Repeating Table

     (The other records are hidden)

    The repeating is labeled after the 2DB  and I am unsure how to reference it.
    Public Sub Level_20_1_20_Adoption_20_Dump_20_2__Level_1_attr_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)


    I want to be able to copy data to another repeating table or use the data in this one to add a dropdown with several choices and a comment box for each and then publish to a SP list as a new record.

    How can i accomplish this??
    Thank you,

     

     

Page 4 of 4 (50 items) < Previous 1 2 3 4
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.