<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: VB Script accessing Secondary Data XML Sources</title><link>https://www.infopathdev.com:443/forums/thread/34071.aspx</link><pubDate>Mon, 10 Nov 2008 21:11:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34071</guid><dc:creator>Jeff3425</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34071.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=34071</wfw:commentRss><description>&lt;p&gt;Good afternoon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thank you very much for the testing code - I had done some testing previously to see if I could at least write, but this allowed me to troubleshoot further.&amp;nbsp; The main error of &lt;strong&gt;DestinationField.text = MatchingXMLField.text&lt;/strong&gt;&amp;nbsp;was due to the fact that they were based off of [&amp;#39;&amp;quot;&amp;nbsp;&amp;amp; &lt;strong&gt;Field1Value&lt;/strong&gt;&amp;nbsp;&amp;amp; &amp;quot;&amp;#39; = ../../../XMLField1 and &amp;#39;&amp;quot;&amp;nbsp;&amp;amp; &lt;strong&gt;Field2Value&lt;/strong&gt;&amp;nbsp;&amp;amp; &amp;quot;&amp;#39;= ../../../../XMLField2]&amp;quot; combined with the &lt;strong&gt;OnLoad&lt;/strong&gt; function I was using.&lt;/p&gt;
&lt;p&gt;This kept failing because Field1Value and Field2Value had default values of &amp;quot;Please Select...&amp;quot; which caused the MatchingXMLField.text to error out because object wasn&amp;#39;t supported with the default text values of &amp;quot;Please Select...&amp;quot;&lt;/p&gt;
&lt;p&gt;To avoid this, I changed the trigger from onload to an onclick event that runs the code when a button is clicked.&amp;nbsp; Everything works like a charm now.&amp;nbsp; I am also sure I could have removed the default text values and used the onload event as well.&amp;nbsp; Thanks again for the assistance Jimmy.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: VB Script accessing Secondary Data XML Sources</title><link>https://www.infopathdev.com:443/forums/thread/34024.aspx</link><pubDate>Sat, 08 Nov 2008 01:15:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34024</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34024.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=34024</wfw:commentRss><description>&lt;p&gt;Hey Jeff,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The most likely cause of that error is that for whatever reason, the XPath in the line that starts with &lt;strong&gt;Set MatchingXMLField =&lt;/strong&gt; is not finding any node.&amp;nbsp; Please take a careful look at that line and make sure everything is sound, and that you didn&amp;#39;t forget the single quotes.&lt;/p&gt;
&lt;p&gt;One thing you can do to begin troubleshooting this is to inspect the XPath being used there. If you add a&amp;nbsp;new node called &amp;quot;XPath&amp;quot; beneath myFields in&amp;nbsp;your form and&amp;nbsp;show it in a&amp;nbsp;text box, you&amp;nbsp;can use it to observe the XPath being used, by changing the end of the code to something like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Dim XPathDisplayNode&lt;br /&gt;Dim XPathToUse&lt;br /&gt;Set XPathDisplayNode =&amp;nbsp;XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:XPath&amp;quot;)&lt;br /&gt;XPathToUse = &amp;quot;/OfferingMaster/Server/Function/ServerTools/StdTools/XMLField[&amp;#39;&amp;quot;&amp;nbsp;&amp;amp; Field1Value&amp;nbsp;&amp;amp; &amp;quot;&amp;#39; = ../../../XMLField1 and &amp;#39;&amp;quot;&amp;nbsp;&amp;amp; Field2Value&amp;nbsp;&amp;amp; &amp;quot;&amp;#39;= ../../../../XMLField2]&amp;quot;&lt;br /&gt;Set MatchingXMLField = SecondaryDataSource.selectSingleNode(XPathToUse)&lt;br /&gt;Set DestinationField = XDocument.DOM.selectSingleNode(&lt;em&gt;XPath of destination node&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;If MatchingXMLField Is Nothing Then&amp;nbsp; &amp;#39;If no matching node was found, then display the XPath in the XPath textbox&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathDisplayNode.text = XPathToUse&lt;br /&gt;Else&amp;nbsp;&amp;nbsp; &amp;#39;If it was a success, set the DestinationField value and clear the XPath Display textbox&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DestinationField.text = MatchingXMLField.text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathDisplayNode.text = &amp;quot;&amp;quot;&lt;br /&gt;End If&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This should enable you to troubleshoot the issue a bit more.&lt;/p&gt;
&lt;p&gt;I noticed that in the XPath you wrote in the initial post, XMLField1 has three ../s before it and XMLField2 has four.&amp;nbsp; It that correct for the hierarchy of your data source?&lt;/p&gt;</description></item><item><title>Re: VB Script accessing Secondary Data XML Sources</title><link>https://www.infopathdev.com:443/forums/thread/34007.aspx</link><pubDate>Fri, 07 Nov 2008 16:58:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:34007</guid><dc:creator>Jeff3425</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/34007.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=34007</wfw:commentRss><description>&lt;p&gt;Thank you Jimmy,&lt;/p&gt;
&lt;p&gt;I have set this up and all works fine until it gets to the last line: &lt;strong&gt;DestinationField.text = MatchingXMLField.text&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When doing this, I generate an error saying &amp;quot;Object Required for MatchingXMLField.text&amp;quot; I have tried various methods such as dropping the .text with no luck.&amp;nbsp; So essentially the destination field won&amp;#39;t associate with the Matching XML field.&amp;nbsp; Thoughts?&lt;/p&gt;</description></item><item><title>Re: VB Script accessing Secondary Data XML Sources</title><link>https://www.infopathdev.com:443/forums/thread/33974.aspx</link><pubDate>Fri, 07 Nov 2008 01:45:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33974</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33974.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=33974</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m not too experienced with VBScript and there might be a better way, but something like the following should work:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Dim Field1Value&lt;br /&gt;Dim Field2Value&lt;br /&gt;Dim SecondaryDataSource&lt;br /&gt;Dim MatchingXMLField&lt;br /&gt;Dim DestinationField&lt;br /&gt;&lt;br /&gt;Field1Value = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:InfoPathField1&amp;quot;).text&lt;br /&gt;Field2Value = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:InfoPathField2&amp;quot;).text&lt;br /&gt;&lt;br /&gt;Set SecondaryDataSource = XDocument.DataObjects(&amp;quot;SecondaryXMLDataSource&amp;quot;).DOM&lt;br /&gt;Set MatchingXMLField = SecondaryDataSource.selectSingleNode(&amp;quot;/OfferingMaster/Server/Function/ServerTools/StdTools/XMLField[&amp;#39;&amp;quot;&amp;nbsp;&amp;amp; Field1Value&amp;nbsp;&amp;amp; &amp;quot;&amp;#39; = ../../../XMLField1 and &amp;#39;&amp;quot;&amp;nbsp;&amp;amp; Field2Value&amp;nbsp;&amp;amp; &amp;quot;&amp;#39;= ../../../../XMLField2]&amp;quot;)&lt;br /&gt;Set DestinationField = XDocument.DOM.selectSingleNode(&lt;em&gt;XPath of destination node&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;DestinationField.text = MatchingXMLField.text&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;#39;m using string concatenation here to include the field values from the main DOM into the XPath statement, and since it&amp;#39;s hard to tell, the &lt;strong&gt;&amp;#39;&amp;quot; + Field1Value + &amp;quot;&amp;#39;&lt;/strong&gt; part consists of &lt;em&gt;single quote, double quote&lt;/em&gt;&amp;nbsp;&amp;amp; Field1Value&amp;nbsp;&amp;amp; &lt;em&gt;double quote, single quote&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>VB Script accessing Secondary Data XML Sources</title><link>https://www.infopathdev.com:443/forums/thread/33959.aspx</link><pubDate>Thu, 06 Nov 2008 19:09:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33959</guid><dc:creator>Jeff3425</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33959.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=33959</wfw:commentRss><description>&lt;p&gt;Good afternoon,&lt;/p&gt;
&lt;p&gt;I am developing a form where I want to set&amp;nbsp;a fields value to the default selection only if the form is new.&amp;nbsp; When the form is opened after it has been saved, I want that same field to display the selected value instead of the default value.&amp;nbsp; I have been given the code for the &amp;quot;isNew&amp;quot; function in vbscript during the onload event, but I am having some trouble creating the default value through VBScript.&amp;nbsp; Essentially, I have &lt;strong&gt;Field = &amp;quot;&lt;/strong&gt;SecondaryXML Field&lt;strong&gt; where&lt;/strong&gt; Infopath Field1 = XML data1 &lt;strong&gt;and &lt;/strong&gt;Infopath Field 2 = XML Data 2&amp;quot;&amp;nbsp; The way this is represented in the xpath fucntion of the Infopath Datasource is xdXDocument:GetDOM(&amp;quot;SecondaryXMLDataSource&amp;quot;)/OfferingMaster/Server/Function/ServerTools/StdTools/XMLField[xdXDocument:get-DOM()/my:myFields/my:InfoPathField1 = ../../../XMLField1 and xdXDocument:get-DOM()/my:myFields/my:InfoPathField2= ../../../../XMLField2.&lt;/p&gt;
&lt;p&gt;My question is how would I convert the xpath function from InfoPath into VBscript?&amp;nbsp; Thank you.&lt;/p&gt;</description></item></channel></rss>