<?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>Read XML Field Value doesn't work</title><link>https://www.infopathdev.com:443/forums/thread/73562.aspx</link><pubDate>Fri, 06 Jan 2012 10:50:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:73562</guid><dc:creator>dchrist1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/73562.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=73562</wfw:commentRss><description>&lt;p&gt;Hello everybody,&lt;/p&gt;
&lt;p&gt;I updated my infopath form and therefore I have a changed structure now. Before I changed it, the field &lt;font color="#a31515"&gt;compl_impl_enter_actual_year&lt;/font&gt;&amp;nbsp;was&amp;nbsp;within the group&amp;nbsp;&lt;font color="#a31515"&gt;myfields&lt;/font&gt;&amp;nbsp;and now it is within the group &lt;font color="#a31515"&gt;myfields/my:General_Information.&amp;nbsp;&lt;/font&gt;That means I have a problem. I have two versions: 1: XML-Files which are based on the old structure and 2: XML-Files which are based on the new structure.&lt;/p&gt;
&lt;p&gt;Now I tried to use the following work around: If I open existing xml files (infopath forms) which are based on the old&amp;nbsp;template I&amp;nbsp;would like&amp;nbsp;to check if the field in the xml field&amp;nbsp;is already existing. If yes, I must set the &amp;quot;new&amp;quot; field&amp;nbsp;during the form is loading. If the field doesn&amp;#39;t exists nothing should happen: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myfields/my:implementation_actual_year&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).text = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Yes&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Then&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;thisXDocument.DOM.selectSingleNode(&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myfields/my:General_Information/my:implementation_actual_year&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).text= &lt;font color="#a31515"&gt;&amp;quot;Yes&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Elseif &lt;font color="#000000"&gt;thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myfields/my:implementation_actual_year&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;).text = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;No&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;thisXDocument.DOM.selectSingleNode(&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myfields/my:General_Information/my:implementation_actual_year&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).text= &lt;font color="#a31515"&gt;&amp;quot;No&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;The problem is, that my code doesn&amp;#39;t work. The code doesn&amp;#39;t sets the field if the field exists within the xml-files. Do you know why it doesn&amp;#39;t work? I use Infopath 2010, but Infopath 2003 templates.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;best regards&lt;br /&gt;Daniel&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item></channel></rss>