Filling repeating table from secondary datasource - InfoPath Dev
in

InfoPath Dev

Filling repeating table from secondary datasource

Last post 07-06-2006 05:54 PM by fredarwin. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-05-2006 08:33 AM

    Filling repeating table from secondary datasource

    Scenario:

    I have two ip forms A and B, in A form i have a id field and a repeating table with n items.

    <ID>1</ID>
    <RT>
    <Requierements>X</Requierements>
    <Requierements>Y</Requierements>
    </RT>


    In form B i have a field id(Combobox) with reference to the ID from the form A(Secondary Datasource) and a repeating table.

    And the question here is:

    when i selecting in then combobox in form B the ID 1 How to do to: fill the repeating table with the n items from the repeating table of the form A.

    I am working with managed code and my forms are in library forms(sharepoint).

    Thanks.
  • 07-06-2006 05:54 PM In reply to

    Re: Filling repeating table from secondary datasource

    Well, i have a solution.

    1. First i have to work with database connections because is more easy deal with it.

    2. i have to write some code:

    a) setup my secodary data source (database)
    var Solicitudes = XDocument.DataObjects("CatSolicitudes").DOM
    Solicitudes.setProperty("SelectionNamespaces",...

    b) depending of selected data, i bring items and fill with them my repeating table of my main connection:


    var oFromItem = XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:SolicitudesMS/@idsolicitudes");
    var selectedNodes=Solicitudes.selectNodes("//dfs:myFields/dfs:dataFields/d:CatSolicitudes/d:DetCatSolicitudes[@idsolicitudes='" + oFromItem.text + "']")

    for (var i=0;i<selectedNodes.length;i++)
    {
    var row = XDocument.DOM.selectSingleNode("//d:DetSolicitudesMS");
    rowClone = row.cloneNode(true);
    XDocument.View.ExecuteAction("xCollection::insert",xmlToEdit="DetSolicitudesMS_18");
    var xdato=selectedNodes.selectSingleNode("@Requerimiento").text;
    rowClone.selectSingleNode("@Requerimiento").text = xdato;
    var parent = XDocument.DOM.selectSingleNode("//d:SolicitudesMS");
    parent.insertBefore(rowClone,row);
    XDocument.View.ExecuteAction("xCollection::remove",xmlToEdit="DetSolicitudesMS_18");
    }

    this work excellent!!!
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.