<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13684.aspx</link><pubDate>Tue, 04 Oct 2005 05:15:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13684</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13684.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13684</wfw:commentRss><description>Default import will add rows to a repeating section if the schema is the same. Custom import can define adding rows to the main data source's schema too. Very powerful tool that noone knows about. Good luck!&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13683.aspx</link><pubDate>Mon, 03 Oct 2005 14:34:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13683</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13683.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13683</wfw:commentRss><description>I really need to look into the Import stuff, but how would it apply in this situation? He's creating rows with information about files in a directory within his form, that he wants to display. What would you be importing? From my understanding (which is limited), Import brings in data from an XML file and makes it available in the target form. How would you get an XML file to dynamically create rows based on files in a directory? &lt;br /&gt;&lt;br /&gt;Maybe you could do like a self-import? Where you import your XDocument.DOM and only read in values that you want and apply them to the table that you want them to go to? &lt;br /&gt;&lt;br /&gt;If I'm making no sense, sorry, just trying to understand.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;</description></item><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13682.aspx</link><pubDate>Sat, 01 Oct 2005 07:43:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13682</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13682.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13682</wfw:commentRss><description>The SDK isn't cold, but my response might have been. Reality is that I haven't had as much time to respond this week. Anyway, sorry about that. Nevertheless, using Merge Forms functionality ala Import will solve this problem. Matt, the Import stuff is very underappreciated but it works great. The key advantage is a) less code, and b) support for multiple kinds of forms (to be imported).&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13681.aspx</link><pubDate>Fri, 30 Sep 2005 17:38:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13681</guid><dc:creator>Gumboot</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13681.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13681</wfw:commentRss><description>Thanks Matt,&lt;br /&gt;&lt;br /&gt;I'll keep those key things in mind.  This at least makes sense to me (unlike the rather cold SDK).&lt;br /&gt;&lt;br /&gt;I'll let you guys know how I make out.  &lt;br /&gt;</description></item><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13680.aspx</link><pubDate>Fri, 30 Sep 2005 14:52:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13680</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13680.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13680</wfw:commentRss><description>Hm, maybe I'm wrong, but I don't think that was the question he was asking, Patrick.&lt;br /&gt;&lt;br /&gt;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:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;// get the list of nodes from table 1&lt;br /&gt;var h_items = xDoc.selectNodes( "/my:Proposal/my:h_items/my:h_item" );		&lt;br /&gt;// get the list of nodes from table 2&lt;br /&gt;var shipTable = xDoc.selectNodes( "/my:Proposal/my:i_items/my:i_item" );&lt;br /&gt;// get the nodes to query to&lt;br /&gt;var h_itemsMstr = intDoc.selectNodes( "/pl:PriceList/pl:FSHardware" );&lt;br /&gt;&lt;br /&gt;// get a sample node to clone, set loop control&lt;br /&gt;var shipNode = shipTable.nextNode(); // gets a sample 'my:i_item' node&lt;br /&gt;var firstTime = true;&lt;br /&gt;&lt;br /&gt;while( h = h_items.nextNode() )&lt;br /&gt;{	&lt;br /&gt;	// ADD ROW TO SHIPPING&lt;br /&gt;	var check = intDoc.selectSingleNode( "/pl:PriceList/pl:FSHardware[pl:h_shipCost != 0 and pl:h_partNum = '" + h.selectSingleNode( "my:h_prodName" ).text + "']" );		&lt;br /&gt;	&lt;br /&gt;	if( firstTime )&lt;br /&gt;	{			&lt;br /&gt;		shipTable.removeAll();&lt;br /&gt;		firstTime = false;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	// establish values &lt;br /&gt;	var name = "Shipping for '" + check.selectSingleNode( "pl:h_name" ).text + "'";&lt;br /&gt;	var qty = getNodeTypedValue( h.selectSingleNode( "my:h_qty" ) );&lt;br /&gt;	var unitPrice = getNodeTypedValue( check.selectSingleNode( "pl:h_shipCost" ) );&lt;br /&gt;	var extPrice = qty * unitPrice;&lt;br /&gt;			&lt;br /&gt;	// create the new row&lt;br /&gt;	var newRow = shipNode.cloneNode(true);&lt;br /&gt;	&lt;br /&gt;	// populate the new row&lt;br /&gt;	setNodeTypedValue( newRow.selectSingleNode("my:i_prodName"), name );&lt;br /&gt;	setNodeTypedValue( newRow.selectSingleNode("my:i_qty"), qty );&lt;br /&gt;	setNodeTypedValue( newRow.selectSingleNode("my:i_unitPrice"), unitPrice );&lt;br /&gt;	setNodeTypedValue( newRow.selectSingleNode("my:i_extPrice"), extPrice );&lt;br /&gt;	&lt;br /&gt;	// add the new row to the list&lt;br /&gt;	xDoc.selectSingleNode( "/my:Proposal/my:i_items" ).appendChild( newRow );	&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;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 ).&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;</description></item><item><title>Re: Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/13679.aspx</link><pubDate>Fri, 30 Sep 2005 06:07:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13679</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13679.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13679</wfw:commentRss><description>Hi Gumboot,&lt;br /&gt;Please read the SDK and use Import and write a custom xsl.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Importing with Script</title><link>https://www.infopathdev.com:443/forums/thread/12593.aspx</link><pubDate>Thu, 29 Sep 2005 16:41:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12593</guid><dc:creator>Gumboot</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12593.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12593</wfw:commentRss><description>I'm creating a template that has a script to import filenames into the document.  I've been able to create a script(within Infopath) that cycles through a folder displaying the names of the files in a popup message boxs.  &lt;br /&gt;&lt;br /&gt;Now I need to append that information into XML in the document.  How the heck do I do that?  Each file has its own element, and also has sub-elements like filename,path, and description.&lt;br /&gt;&lt;br /&gt;For Each oFile in oFSO.GetFolder(FolderName).Files&lt;br /&gt;  1) Add an additional element to the end of the document.&lt;br /&gt;  2) Enter in the Path and the Filename into it.&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;I think this is a rather rookie question - hope someone can help&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>