<?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: Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/98010.aspx</link><pubDate>Wed, 18 Jun 2014 16:48:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:98010</guid><dc:creator>NickCalifornia</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/98010.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=98010</wfw:commentRss><description>&lt;p&gt;That&amp;#39;s OK, at least someone with a similar issue may find this thread useful ;).&amp;nbsp; Also, I refined the code a bit more once I wrote it to iterate through all possibilities of a repeating table field containing a file attachment.&amp;nbsp; Through this process I also realized that essentially &amp;quot;moving to the attribute&amp;quot; is the same concept&amp;nbsp;as setting the dimensioned xpathnavigator to that attribute.&amp;nbsp; Thanks for the help as usual!&lt;/p&gt;</description></item><item><title>Re: Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/97994.aspx</link><pubDate>Wed, 18 Jun 2014 00:56:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97994</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97994.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97994</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m sorry you ended up talking to yourself here, but I&amp;#39;m glad you figured it out &amp;amp; thanks for posting your solution.&lt;/p&gt;
&lt;p&gt;See how in DeleteNil in the if statement the node is being moved to the nil attribute and then DeleteSelf() is called? The node at that point is actually the nil attribute... &lt;/p&gt;</description></item><item><title>Re: Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/97993.aspx</link><pubDate>Tue, 17 Jun 2014 22:49:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97993</guid><dc:creator>NickCalifornia</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97993.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97993</wfw:commentRss><description>&lt;p&gt;Well after messing around with this for a while I&amp;#39;ve finally found a solution.&amp;nbsp; Again, tying back to the &amp;quot;nil&amp;quot; issue; deleting this node was causing some issues when I attempted to actually apply the value over after removing it.&amp;nbsp; I decided to copy the examples I found exactly (they passed the specific node into a sub, whereas I was using DeleteSelf directly on the node path before passing it).&amp;nbsp; This subtle change apparently makes it all work; Here&amp;#39;s the code in case anyone cares :).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&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; MainNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:RepeatingGroup1/my:DestinationField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager) _&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;.GetAttribute(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;nil&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).ToString() = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;True&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&lt;/p&gt;&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;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; MyValue &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = MainNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:RepeatingGroup1/my:DestinationField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;DeleteNil(MyValue)&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; MyValueByte() &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&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;Byte&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; = Convert.FromBase64String(SecNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/ns1:myFields/ns1:RepeatingGroup2/ns1:SourceField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).ToString())&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;MyValue.SetValue(Convert.ToBase64String(MyValueByte))&lt;/p&gt;
&lt;p&gt;&lt;/font&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;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&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;Sub&lt;/p&gt;&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;Public&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;Sub&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; DeleteNil(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; node &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator)&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;font size="2"&gt; (node.MoveToAttribute( _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;nil&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&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&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;node.DeleteSelf()&lt;/p&gt;
&lt;p&gt;&lt;/font&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;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&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;Sub&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/97992.aspx</link><pubDate>Tue, 17 Jun 2014 22:05:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97992</guid><dc:creator>NickCalifornia</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97992.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97992</wfw:commentRss><description>&lt;p&gt;Ok, wow, another update.&amp;nbsp; I was able to transfer this over if I physically pre-populated the target destination with any type of file attachment; i.e. this works if I pre-populate the field (also, ignore my second post, the data is available from the XML source document).&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;font size="2"&gt;::::::::::::::::::::&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;MainNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:RepeatingGroup[1]/my:DestinationField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue( _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;SecNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/ns1:myFields/ns1:RepeatingGroup[1]/ns1:SourceField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;::::::::::::::::::::&amp;nbsp;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I guess it has something to do with the &amp;quot;nil&amp;quot; attribute; I&amp;#39;ve been able to use &amp;quot;MoveToAttribute&amp;quot; to detect the nil attribute and then delete the node (like all the examples out there say).&amp;nbsp; But my issue is now re-adding the node correctly since there won&amp;#39;t be any scenario where I want the user to pre-populate the destination field.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;font size="2"&gt;Thoughts anyone?&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/97986.aspx</link><pubDate>Tue, 17 Jun 2014 18:03:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97986</guid><dc:creator>NickCalifornia</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97986.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97986</wfw:commentRss><description>&lt;p&gt;&lt;strike&gt;Ok, so I think the main issue here is since I am trying to add a file attachment from a secondary data source, the information actually does not carry over since the only field I can actually promote is a &amp;quot;count&amp;quot; field of the XML entry.&amp;nbsp; I think that may be the issue and perhaps I need to build this attachment string in the source data source first, then use that to build any attachments out in the new form template?&lt;/strike&gt;&lt;/p&gt;</description></item><item><title>Encode/Decode File Attachment From Form Template 1 To Form Template 2</title><link>https://www.infopathdev.com:443/forums/thread/97968.aspx</link><pubDate>Tue, 17 Jun 2014 01:35:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97968</guid><dc:creator>NickCalifornia</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97968.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97968</wfw:commentRss><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;ve read quite a bit on this, but am finally feeling stumped.&amp;nbsp; The basic scenario is I have a file attachment in 1 form template that I&amp;#39;d like to be able to programmatically attach in a different form template.&lt;/p&gt;
&lt;p&gt;I have both attachment fields; AttachmentStartField, AttachmentDestination; available through either a secondary data source or main fields (myFields):&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve read over articles about utilizing a class for an ecoder/decoder, but it doesn&amp;#39;t quite address decoding an existing attached file from a node and then encoding that file to a new node by using &amp;quot;SetValue&amp;quot;.&amp;nbsp; Thoughts/suggestions?&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; MainNav &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.CreateNavigator()&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; SecNav &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.DataSources(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;XML Connection&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).CreateNavigator()&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; DecodeMS &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&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;New&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; MemoryStream(Convert.FromBase64String(SecNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/ns1:myFields/ns1:AttachmentStartField&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).ToString()))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; DecodeMSByte &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&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;Byte&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;() = DecodeMS.ToArray()&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39; What steps do I need to tweak to convert it to the appropriate format/etc&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;to accept in the AttachmentDestination field? As it stands I get non-data type errors with this code. Thanks!&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;MainNav.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:AttachmentDestination&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(Convert.ToBase64String(DecodeMSByte))&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>