Repeating Problem with Repeating Table - InfoPath Dev
in

InfoPath Dev

Repeating Problem with Repeating Table

Last post 01-11-2006 08:16 PM by Lewis68. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-11-2006 03:58 PM

    Repeating Problem with Repeating Table

    I know this has been asked and answered many times, but I'm still having trouble relating the solution it to my situation.

    I have a Lookup field in a repeating table. When someone enters a value in the the field, it goes out to a 2nd data source and returns data. I want the record in the table to be filled with these returned fields. However when I set the fields, it's always the first record that gets filled, not the current record.

    I came across Current() in this forum that seems to be the answer. I just don't know where it goes in my code. Can someone help me out?

    Here is the code in the OnAfterChange event of the lookup field in the table record. I believe the Red lines are the ones that need to be changed.

    Thanks


    var node = XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@quotenum");
    quote = node.text;

    var obj = XDocument.DataObjects("VendorList");
    obj.DOM.setProperty("SelectionNamespaces", 'xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-12-26T21:32:32"');

    var r = eventObj.NewValue;
    obj.QueryAdapter.Command = "select * from VendorList where number = '" + r + "'";
    obj.QueryAdapter.Query();

    var node = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@name");
    if (node) {
    var name = node.text;
    var add = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@address").text;
    var city = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@city").text;
    var st = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@state").text;
    var zip = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@zip").text;
    var con = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@contactname").text;
    var num = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@contactnum").text;
    // var ema = obj.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorList/@email").text;
    }else {
    var name = "";
    var add = "";
    var city = "";
    var st = "";
    var zip = "";
    var con = "";
    var num = "";
    // var ema = "";
    }

    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@quotenum").text = quote;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@name").text = name;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@address").text = add;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@city").text = city;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@state").text = st;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@zip").text = zip;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@contactname").text = con;
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@contactnum").text = num;
    //XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect/@email").text = ema;

  • 01-11-2006 06:01 PM In reply to

    Re: Repeating Problem with Repeating Table

    Try this:

    eventObj.Site.parentNode.selectSingleNode( "@quotenum" ).text = quote;

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-11-2006 06:54 PM In reply to

    Re: Repeating Problem with Repeating Table

    Hello Matt,

    Thanks for the response.

    However, I get an error when I use that line of code. "Site.parentNode is null or not an object".

    Any idea's?
  • 01-11-2006 07:50 PM In reply to

    Re: Repeating Problem with Repeating Table

    Hm, it must be different for databases. This works with XML as main DOM.

    Try this:
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect[ @quotenum = '" + r + "']/@quotenum").text = quote;



    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-11-2006 08:16 PM In reply to

    Re: Repeating Problem with Repeating Table

    Almost!

    I changed the line to this and it works.
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:VendorSelect[@number = '" + r + "']/@quotenum").text = quote;

    However I get an error when I Insert a new record in the table. "XDocument.DOM.selectSingleNode(...) is null or not an object." What could be causing that?

    Also, what exactly is [@number = '" + r + "'] doing?

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