<?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: How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64568.aspx</link><pubDate>Thu, 24 Feb 2011 22:25:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64568</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64568.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64568</wfw:commentRss><description>&lt;p&gt;Glad you figured it out -- and I apologize for missing your post!&lt;/p&gt;</description></item><item><title>Re: How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64561.aspx</link><pubDate>Thu, 24 Feb 2011 20:14:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64561</guid><dc:creator>ashoke</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64561.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64561</wfw:commentRss><description>&lt;p&gt;Hi - I just have fixed the issue. It was my xpath problem. It should be &lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:queryFields/q:top/@PrgYear&amp;quot;. &lt;font color="#000000"&gt;It&amp;#39;s now working perfect. Thanks, Ash&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64554.aspx</link><pubDate>Thu, 24 Feb 2011 17:40:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64554</guid><dc:creator>ashoke</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64554.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64554</wfw:commentRss><description>&lt;p&gt;Hi Hilary - Good morning! I have a similar yet simpler situation for a form connected to Access db. I need to get the filename from an input in a&amp;nbsp;node named &amp;quot;PrgYear&amp;quot;. Following code isn&amp;#39;t working. Can you please have a look and help me figure out the problem? Thanks, Ash&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; filename = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;dfs:queryFields/q:top/@PrgYear&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;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).Value;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.CurrentView.Export(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;@&amp;quot;G:\02 Dept Folders\Clinical Registries\43130 CORR\43132 Transplants\07 Statistics\Transplant Quarterly Reports\ASH\input_form&amp;amp;db\&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; + filename + &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;_Table1A.xls&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;ExportFormat&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Mht);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;The error msg:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;System.NullReferenceException&lt;br /&gt;Object reference not set to an instance of an object.&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Table_123_exp.FormCode.CTRL830_7_Clicked(Object sender, ClickedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)&lt;br /&gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64235.aspx</link><pubDate>Wed, 16 Feb 2011 16:25:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64235</guid><dc:creator>natchos</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64235.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64235</wfw:commentRss><description>&lt;p&gt;Good morning, just a quick note to say thank you so much for your help!&lt;/p&gt;
&lt;p&gt;And also, for your tips! Much appreciated! I shall do that in the future.&lt;/p&gt;
&lt;p&gt;Thanks again and have a great day!&lt;/p&gt;
&lt;p&gt;Natacha&lt;/p&gt;</description></item><item><title>Re: How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64192.aspx</link><pubDate>Tue, 15 Feb 2011 01:33:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64192</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64192.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64192</wfw:commentRss><description>&lt;p&gt;Hi:&lt;/p&gt;
&lt;p&gt;You can concatenate your two field values together.&lt;/p&gt;
&lt;p&gt;So, like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;field10 = &lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:field10&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&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;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).Value;&lt;br /&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font size="2"&gt; field7 = &lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:field7&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&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;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).Value;&lt;br /&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;font size="2"&gt; Filename = field7 +&amp;nbsp;&lt;font color="#800000"&gt;&amp;quot; - &lt;font size="2"&gt;&lt;font size="2"&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; + field10;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Of course, you could also add another field to your form that uses the concatenated values as a default, then just reference that field in your code.&lt;/p&gt;
&lt;p&gt;Now, I would be remiss if I didn&amp;#39;t mention to you that you really, really, really, if at all possible, should rename your fields. If your form is not currently in production, you can rename these without too much trouble, and then, in a few months, when you open this template to work on it again, you&amp;#39;ll be so happy you did. If you give all your fields and groups meaningful names, future you will thank present you (as will any other designer who ever needs to work on your form).&lt;/p&gt;
&lt;p&gt;If this form is already in production, things get more complicated, because you don&amp;#39;t want to risk losing data, and writing a custom upgrade transform is probably a bit advanced. But for next time, be sure to name your fields right from the start.&lt;/p&gt;</description></item><item><title>How to select 2 fields to name form with code?</title><link>https://www.infopathdev.com:443/forums/thread/64175.aspx</link><pubDate>Mon, 14 Feb 2011 15:26:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:64175</guid><dc:creator>natchos</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/64175.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=64175</wfw:commentRss><description>&lt;p&gt;Hello everyone.&lt;/p&gt;
&lt;p&gt;This site has been very handy for me. I found lots of great ideas for my forms, thank you!&lt;/p&gt;
&lt;p&gt;I have a question that I cannot find an answer for, perhaps one of you can help me?&lt;/p&gt;
&lt;p&gt;I want to be able to chose field7 and field10 on one of my forms to create the name of my file when using a custom button with code.&lt;/p&gt;
&lt;p&gt;Here is the code I have, but it will only work for field7, I do not know if it is possible to chose 2 fields to name a file.&amp;nbsp; If it is, could you please help me with the syntax please?&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; Filename = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:field7&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&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;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.NamespaceManager).Value;&lt;/font&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;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Print();&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.CurrentView.Export(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;@&amp;quot;\\fps1\es\&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; + Filename + &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;.pdf&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, Microsoft.Office.InfoPath.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;ExportFormat&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Pdf);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Thank you very much!&lt;/font&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>