<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>XPATH code help- Set default value of a field to be the content of 2 different data sources</title><link>https://www.infopathdev.com:443/forums/thread/103175.aspx</link><pubDate>Wed, 08 Jul 2015 18:26:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:103175</guid><dc:creator>tbrereto</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/103175.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=103175</wfw:commentRss><description>&lt;p&gt;I have a form which has2 dropdown Lists.&amp;nbsp; These lists are populated from different .xml files ie MinorDistributionList, MajorDistribuitonList, etc etc. The &amp;quot;Minor&amp;quot; list is populated using the values of &amp;quot;MinorDistributionList.xml&amp;quot; and the Major&amp;quot; list is populated from &amp;quot;MajorDistributionList.xml.&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;I want to create&amp;nbsp;one text field which will populate with the &amp;quot;name&amp;quot; value of the dropdown if either&amp;nbsp;one is selected.&amp;nbsp; I have been able to make it work one field using the below XPath.&lt;/p&gt;&lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span style="color:red;line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MinorDistributionList&amp;quot;)/MinorDistribution/Minor/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MINORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;

&lt;font size="2" face="Arial"&gt;However now I need to modify the code in a way which will allow the same field to pull from the other &amp;quot;major&amp;quot; Dropdown.&amp;nbsp; Both dropdown will not contain data at the same time, so there should not be any conflicts. The code which makes the field populate with the &amp;quot;Major&amp;quot; value only is&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:red;line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MajorDistributionList&amp;quot;)/MajorDistribution/Major/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MAJORDISTLIST]&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Looking at this post: &lt;a href="http://www.infopathdev.com/forums/p/27532/95371.aspx"&gt;http://www.infopathdev.com/forums/p/27532/95371.aspx&lt;/a&gt;&amp;nbsp;I attempted to modify my xpath to allow this field to do as I want.&amp;nbsp; My modified xpath is below:&lt;/p&gt;&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;xdMath:Eval(xdMath:Eval(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MinorDistributionList&amp;quot;)/MinorDistribution/Minor/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MINORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;, &amp;#39;concat(substring(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MinorDistributionList&amp;quot;)/MinorDistribution/Minor/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MINORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;, 1, &lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MinorDistributionList&amp;quot;)/MinorDistribution/Minor/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MINORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt; * string-length(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MinorDistributionList&amp;quot;)/MinorDistribution/Minor/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MINORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;)), substring(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MajorDistributionList&amp;quot;)/MajorDistribution/Major/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MAJORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;, 1, (string-length(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MajorDistributionList&amp;quot;)/MajorDistribution/Major/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MAJORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;) &amp;gt; 1) * string-length(&lt;/font&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;xdXDocument:GetDOM(&amp;quot;MajorDistributionList&amp;quot;)/MajorDistribution/Major/Name&lt;span class="error5"&gt;[../ID = xdXDocument:get-DOM()/my:myFields/my:MAJORDISTLIST]&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span&gt;)))&amp;#39;), &amp;quot;..&amp;quot;)&lt;/span&gt;&lt;span style="line-height:115%;font-size:10.5pt;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;

However when I try to load the form I get the following error message in the details section:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;MSXML5.DLL&lt;br /&gt;Reference to undeclared namespace prefix: &amp;#39;my&amp;#39;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Error occurred during a call to property or method &amp;#39;Eval&amp;#39;.&lt;/p&gt;&lt;p&gt;Any insight here as to how i can change my xpath to allow this to work?&amp;nbsp; Thanks so much in advance&lt;/p&gt;</description></item></channel></rss>