<?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: variables are gone after new record</title><link>https://www.infopathdev.com:443/forums/thread/59944.aspx</link><pubDate>Tue, 05 Oct 2010 20:55:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:59944</guid><dc:creator>Desmo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/59944.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=59944</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;NEvermind Patrick, I&amp;#39;m very happy now 
as I did some investigating w/ existing corporate infopath forms and 
discovered there&amp;#39;s a webservice for getting the employee profile! I&amp;#39;m 
golden, thanks again</description></item><item><title>Re: variables are gone after new record</title><link>https://www.infopathdev.com:443/forums/thread/59943.aspx</link><pubDate>Tue, 05 Oct 2010 20:54:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:59943</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/59943.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=59943</wfw:commentRss><description>&lt;p&gt;Too bad InfoPath doesn&amp;#39;t let you add New Record as an action to a rule since then you could set the value after that as a separate rule/action. &lt;/p&gt;
&lt;p&gt;Have you tried to set a default value for Relayview? Just go to the data source and double click it and click on the Fx for the default value and add XdExtension::&amp;lt;yourfunction name&amp;gt;. In 2007/10 this is easy because there&amp;#39;s a username function that InfoPath uses. A better option might be to call a SharePoint GetUserProfileName or Active Directory Web Service (such as Qdabra&amp;#39;s) that doens&amp;#39;t require code. &lt;/p&gt;</description></item><item><title>Re: variables are gone after new record</title><link>https://www.infopathdev.com:443/forums/thread/59936.aspx</link><pubDate>Tue, 05 Oct 2010 20:11:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:59936</guid><dc:creator>Desmo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/59936.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=59936</wfw:commentRss><description>&lt;p&gt;Thanks for the quick Reply Patrick, it didn&amp;#39;t dawn on me that it would have made much a difference to start w/ a blank form vs creating from a database. So in that reality, this issue would not occur? If I can muster the motivation, I might give that a shot and thanks for the tip!&lt;br /&gt;&lt;br /&gt;This form loads on a view that displays a repeating section where all records of time entries are displayed as seen below. The New Record button is as self described, and loads to the default view, (new record section).&amp;nbsp; The submit button just submits, calls a blank id value, and queries back to the original page. so not much underlying code there.&amp;nbsp; It doesn&amp;#39;t seem to help if I add the following to the submit button onclick event.&amp;nbsp;&amp;nbsp; Relayview is the name of the myfield that holds the user name&lt;br /&gt;&lt;/p&gt;&lt;p&gt;XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:Relayview&amp;quot;).text= username;

&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: variables are gone after new record</title><link>https://www.infopathdev.com:443/forums/thread/59930.aspx</link><pubDate>Tue, 05 Oct 2010 19:18:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:59930</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/59930.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=59930</wfw:commentRss><description>&lt;p&gt;Hi Desmo and thanks for the positive comments! :)&lt;/p&gt;
&lt;p&gt;You have discovered one of the limits of Database bound forms - the default functionality of the database binding overrides some of the functionality of InfoPath. If you had instead started from a Blank form and added XML fields to your schema (instead of binding to a Database), you could easily do this by adding a button with two rules - 1) query Database/Web Service, 2) set values from database into main data source (or just drag and drop the secondary data source into your view) and finally, 3) set the username value. While starting from blank gives you more flexibility, it does mean you have to hook up the Database or Web Service to pull and push data to your backend, but that&amp;#39;s not hard to do and the gained flexibility is much more valuable.&lt;/p&gt;
&lt;p&gt;With your Database backed form, you still have lots of options. You can add an event that you catch after the New Record button is clicked and you can set the username again on this event. What event is your code currently hooked up to?&lt;/p&gt;
&lt;p&gt;More after your reply,&lt;/p&gt;</description></item><item><title>variables are gone after new record</title><link>https://www.infopathdev.com:443/forums/thread/59847.aspx</link><pubDate>Tue, 05 Oct 2010 18:34:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:59847</guid><dc:creator>Desmo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/59847.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=59847</wfw:commentRss><description>&lt;p&gt;Hello everyone,&amp;nbsp; this forum has always been so helpful, I&amp;#39;m hoping you guys can help me solve one more.&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;Utilizing infopath 2003 (yes, large corporations tend to lag behind on upgrades) I have inserted a get login username code based off of a prior posting which works great. &lt;/p&gt;&lt;p&gt;var wshShell = new ActiveXObject(&amp;quot;Wscript.Shell&amp;quot;);&lt;br /&gt;var wshEnv = wshShell.Environment(&amp;quot;Process&amp;quot;);
&lt;br /&gt;var username = wshEnv.Item(&amp;quot;UserName&amp;quot;);&lt;br /&gt;
XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:Relayview&amp;quot;).text= username;

&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;ve relayed this value to personal fields that build logic off of one another to derive the group and dept. ID as well. &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;The form itself is a time tracking form, where users log their projects. Its great that it can self identify who the user is, but here&amp;#39;s the issue.&lt;/p&gt;&lt;p&gt;&amp;nbsp;As soon as the &amp;quot;new record&amp;quot; button is clicked, Vuwala,&amp;nbsp; everything is wiped out and all my concatenated fields that rely on the username variable are reduced to junk.&amp;nbsp;&amp;nbsp; Using a refresh button doesn&amp;#39;t work bc it only refreshes the data connection.&amp;nbsp; The only option I can see at this point is that I have the form close and re-open, but that will look terrible. &lt;/p&gt;&lt;p&gt;&amp;nbsp;does anyone know of any work arounds? &amp;nbsp; It seems I just need to refresh the scripts and webservice for the username isn&amp;#39;t an option either b/c I have no idea what the correct adpx addresses are.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Thanks in advance!! &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>