<?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>Copying query results into a new record</title><link>https://www.infopathdev.com:443/forums/thread/52996.aspx</link><pubDate>Mon, 22 Mar 2010 15:17:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52996</guid><dc:creator>jdbean86</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52996.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=52996</wfw:commentRss><description>&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;Hi!&amp;nbsp; I am a new InfoPath user, and I am encountering a problem getting a form set up.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;Here is the rhyme and reason behind the design of my form, first of all:&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;This form is to be used in the security offices at the plant I work at for the purposes of employee call offs.&amp;nbsp; Once the form is filled out, it will be submitted into a table on the access database we have.&amp;nbsp; Now, I want the logs to be linked by the employee ID number.&amp;nbsp; The problem with this is that when employees call in, they don&amp;#39;t always know their ID number, or only know the old identifier.&amp;nbsp; I built a query on the first page of my form to search the employee records by last name, old identifier, and new identifier.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;A repeating list then pops up, and there is a button next to every record that can be clicked to isolate the record (which requeries the database using only that employee ID).&amp;nbsp; It&amp;#39;s probably not very efficient, but it moves quickly enough for my purposes.&amp;nbsp; Then the form automatically switches over to another view, where some information is automatically carried over from my information table (department, supervisor, etc etc), to fields for my call log table.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;Originally, I had my call log fields set to pull default values from the remaining employee information entry on the first form.&amp;nbsp; This worked great until I realized that trying to submit the 2nd call log for an employee would pull up all the information from the first log automatically.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;My problem really is this: when I isolate the employee to submit a call log for, I need to create a new call log record&amp;nbsp;that pulls over some information from the employee records as well as includes a few fields the security office fills.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;The code I linked to the button is this:&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="301435814-22032010"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;var sapstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/q:Master_Employee_Table/SAP_ID&amp;quot;); var firststr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:Master_Employee_Table/First_name&amp;quot;); var laststr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:Master_Employee_Table/Last_name&amp;quot;); var namestr = XDocument.DOM.selectSingleNode(&amp;quot;//my:CombinedName&amp;quot;); namestr.text = firststr + &amp;quot; &amp;quot; + laststr; var deptstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:Job_Table/Cost_Ctr&amp;quot;); var supstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:Job_Table/Name_of_superior__OM_&amp;quot;); var subsapstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:CallLogs/SAP_ID&amp;quot;); subsapstr = sapstr var subnamestr = XDocument.DOM.selectSingleNode(&amp;quot;//my:CombinedName&amp;quot;); subnamestr.text = namestr.text var subdeptstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:CallLogs/Cost_Ctr&amp;quot;); subdepstr = deptstr var subsupstr = XDocument.DOM.selectSingleNode(&amp;quot;/d:myFields/d:dataFields/d:CallLogs/Name_of_superior__OM_&amp;quot;); subsupstr = supstr&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;&lt;font face="Arial" size="2"&gt;And it doesn&amp;#39;t transfer and show the fields over like I would hope.&amp;nbsp; I am working in javascript, and am in completely foreign territory - I just got saddled with this project because I&amp;#39;m &amp;quot;good with computers.&amp;quot;&amp;nbsp; My working knowledge of JS is absolutely zero, so any help you could provide would be amazing.&amp;nbsp; These forums have been invaluable the last week getting other infopath forms set-up, but this one has me for a loss.&amp;nbsp; I&amp;#39;ve looked at some other threads that may be similar to this, but I&amp;#39;m struggling with understanding what is going on.&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span class="301435814-22032010"&gt;&lt;font face="Arial" size="2"&gt;Thanks!&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;</description></item></channel></rss>