Hm, maybe I'm wrong, but I don't think that was the question he was asking, Patrick.
If you're trying to populate a repeating table within your DOM (which is what it seems like you're trying to do) - try this:
// get the list of nodes from table 1
var h_items = xDoc.selectNodes( "/my:Proposal/my:h_items/my:h_item" );
// get the list of nodes from table 2
var shipTable = xDoc.selectNodes( "/my:Proposal/my:i_items/my:i_item" );
// get the nodes to query to
var h_itemsMstr = intDoc.selectNodes( "/pl:PriceList/pl:FSHardware" );
// get a sample node to clone, set loop control
var shipNode = shipTable.nextNode(); // gets a sample 'my:i_item' node
var firstTime = true;
while( h = h_items.nextNode() )
{
// ADD ROW TO SHIPPING
var check = intDoc.selectSingleNode( "/pl:PriceList/pl:FSHardware[pl:h_shipCost != 0 and pl:h_partNum = '" + h.selectSingleNode( "my:h_prodName" ).text + "']" );
if( firstTime )
{
shipTable.removeAll();
firstTime = false;
}
// establish values
var name = "Shipping for '" + check.selectSingleNode( "pl:h_name" ).text + "'";
var qty = getNodeTypedValue( h.selectSingleNode( "my:h_qty" ) );
var unitPrice = getNodeTypedValue( check.selectSingleNode( "pl:h_shipCost" ) );
var extPrice = qty * unitPrice;
// create the new row
var newRow = shipNode.cloneNode(true);
// populate the new row
setNodeTypedValue( newRow.selectSingleNode("my:i_prodName"), name );
setNodeTypedValue( newRow.selectSingleNode("my:i_qty"), qty );
setNodeTypedValue( newRow.selectSingleNode("my:i_unitPrice"), unitPrice );
setNodeTypedValue( newRow.selectSingleNode("my:i_extPrice"), extPrice );
// add the new row to the list
xDoc.selectSingleNode( "/my:Proposal/my:i_items" ).appendChild( newRow );
}
I know this is probably very hard to understand, but it's the best I could whip up in 5 mins. Also, I'm copying rows from one table in InfoPath to another. You could easily modify the code to copy elements from an oFile object and put them into the row. The key things you need to look at are shipTable.removeAll(), var newRow = shipNode.cloneNode(true), and xDoc.selectSingleNode( "/my:Proposal/my:i_items" ).appendChild( newRow ).
---------------
Matt Faus
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge