Move an Inserted Node - InfoPath Dev
in

InfoPath Dev

Move an Inserted Node

Last post 08-11-2010 01:45 PM by brandtsmith. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 08-11-2010 01:45 PM

    Move an Inserted Node

    I have a database form with 2 tables joined for the main datasource...i do an insert with:

     function ApplyPayment(Invoice, PaymentID, AmountPaid, InvoiceRow)
    {
     XDocument.UI.Alert("Inv=" + Invoice + " PayID=" + PaymentID + " AP=" + AmountPaid + " IR=" + InvoiceRow);
     XDocument.View.ExecuteAction("xCollection::insert", "tblPosting_59");
     var lines = XDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices/d:tblPosting");
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices/d:tblPosting[" + lines.length + "]/@PaymentID",PaymentID);
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices/d:tblPosting[" + lines.length + "]/@Invoice",Invoice);
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices/d:tblPosting[" + lines.length + "]/@Amount",AmountPaid);
    }

    when I submit this the Invoice column reverts back to the first Invoice value...producing a duplicate key condition which sql rejects...so I guess I am only adding Posting nodes to the first Invoice node...which causes the reversion to the first Invoice value

     when I try using :

    function ApplyPayment(Invoice, PaymentID, AmountPaid, InvoiceRow)
    {
     XDocument.UI.Alert("Inv=" + Invoice + " PayID=" + PaymentID + " AP=" + AmountPaid + " IR=" + InvoiceRow);
     XDocument.View.ExecuteAction("xCollection::insert", "tblPosting_59");
     var lines = XDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices/d:tblPosting");
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices[" + InvoiceRow + "]/d:tblPosting[" + lines.length + "]/@PaymentID",PaymentID);
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices[" + InvoiceRow + "]/d:tblPosting[" + lines.length + "]/@Invoice",Invoice);
     setNodeValue("/dfs:myFields/dfs:dataFields/d:tblAR_Invoices[" + InvoiceRow + "]/d:tblPosting[" + lines.length + "]/@Amount",AmountPaid);
    }

     I get red asterisks in my Posting values - except for the first value - which is correct...

     

    So - is there anyway to "move" an inserted node to a different parent node in jscript?

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