<?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: Setting the value of a date field in a repeating table equal to the field in the main data source in code using InfoPath 2003.</title><link>https://www.infopathdev.com:443/forums/thread/38590.aspx</link><pubDate>Wed, 18 Feb 2009 20:08:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38590</guid><dc:creator>Jermaine Cross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38590.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38590</wfw:commentRss><description>&lt;p&gt;The timecard template that is included with inofpath gives you&amp;nbsp;a sum of the columns selecting all the nodes. I am trying to add one column to the next column which equals the third colum for each row.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;function msoxd_my_field5::OnAfterChange(eventObj) { // Write code here to restore the global state. if (eventObj.IsUndoRedo) { return; } var oField3 = eventObj.Site.selectSingleNode(&amp;quot;../my:field3&amp;quot;); oField3.text = Calculate(); } function Calculate() { var f1 = Number(XDocument.DOM.selectSingleNode(&amp;quot;//my:field1&amp;quot;).text); var f5 = Number(XDocument.DOM.selectSingleNode(&amp;quot;//my:field5&amp;quot;).text); var sum; sum = f1 + f5; return(sum); }&lt;/p&gt;
&lt;p&gt;The code above describes what I have come up with but it keeps only adding the first row&amp;nbsp; as the sum for all entries in&amp;nbsp; the third row. I do believe that I am not quite sure how to specify each specific row to give a sum. I even tried using the position() method which I think might work.&lt;/p&gt;</description></item><item><title>Re: Setting the value of a date field in a repeating table equal to the field in the main data source in code using InfoPath 2003.</title><link>https://www.infopathdev.com:443/forums/thread/38572.aspx</link><pubDate>Wed, 18 Feb 2009 16:50:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38572</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38572.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38572</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m perplexed to see you casting the time as a number -- Will Javascript do that? I would think you&amp;#39;d need to cast the text to a datetime value and then get the difference. &lt;a href="http://articles.techrepublic.com.com/5100-10878_11-6076869.html"&gt;Here&amp;#39;s&lt;/a&gt; a link to a site with some information on manipulating date and time with Javascript. The Timecard sample that shipped with IP 2003 also supposedly has this functionality -- you should take a look at it. I&amp;#39;ll attach the template to this post -- right click the link in the post header and select &amp;#39;Save As&amp;#39;. Then you can open it in design mode and look at the script it uses.&lt;/p&gt;</description></item><item><title>Re: Setting the value of a date field in a repeating table equal to the field in the main data source in code using InfoPath 2003.</title><link>https://www.infopathdev.com:443/forums/thread/38462.aspx</link><pubDate>Mon, 16 Feb 2009 17:57:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38462</guid><dc:creator>Jermaine Cross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38462.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38462</wfw:commentRss><description>&lt;p&gt;Yes I do I figured out that problem.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;function DayofWeek() { var xDoc = XDocument.DOM; var dt = xDoc.selectSingleNode(&amp;quot;//my:MainSelectionWeekOf&amp;quot;).text; var month = dt.substring(5,7); var date = dt.substring(8,11); var year = dt.substring(0,4); var ndate = month + &amp;quot;/&amp;quot; + date + &amp;quot;/&amp;quot; + year; var my_day=new Date(ndate); var day_name=new Array(7); day_name[0]=&amp;quot;Sunday&amp;quot; day_name[1]=&amp;quot;Monday&amp;quot; day_name[2]=&amp;quot;Tuesday&amp;quot; day_name[3]=&amp;quot;Wednesday&amp;quot; day_name[4]=&amp;quot;Thursday&amp;quot; day_name[5]=&amp;quot;Friday&amp;quot; day_name[6]=&amp;quot;Saturday&amp;quot; return(day_name[my_day.getDay()]); }&lt;/p&gt;
&lt;p&gt;// Get Day of the week from date selected var dayField = XDocument.DOM.selectSingleNode(&amp;quot;//my:DayoftheWeek&amp;quot;); dayField.text = DayofWeek();&lt;/p&gt;
&lt;p&gt;But now I need help with this:&amp;nbsp;I have a p&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;roblem with&amp;nbsp;calculating a field in a repeating table. I am using say field1 - field2 to get&amp;nbsp;a value&amp;nbsp;and put it in field3. Can&amp;nbsp;you help me with this. I tried&amp;nbsp;doing this thru code in javascript and what i get is a null value for some&amp;nbsp;reason. Thank you in advance.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&amp;nbsp;function TimeDiff() { var xDoc = XDocument.DOM; var time1 = Number(xDoc.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TimeSheetMain/d:TimeSheetDetail/@In1&amp;quot;).text); var time2 = Number(xDoc.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TimeSheetMain/d:TimeSheetDetail/@Out1&amp;quot;).text); var maxhrs = 24; var td1; { //Regular business hours if(time1time2){ td1 = maxhrs - time1 + time2; } return(td1); } }&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;function msoxd__TimeSheetDetail_Out1_attr::OnAfterChange(eventObj) { var diff = eventObj.Site.selectSingleNode(&amp;quot;../@Reg&amp;quot;); diff = TimeDiff(); }&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Verdana&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;</description></item><item><title>Re: Setting the value of a date field in a repeating table equal to the field in the main data source in code using InfoPath 2003.</title><link>https://www.infopathdev.com:443/forums/thread/38459.aspx</link><pubDate>Mon, 16 Feb 2009 16:51:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38459</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38459.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38459</wfw:commentRss><description>&lt;p&gt;Okay, do you have the field MainSelectionWeekOf set as a Date data type?&lt;/p&gt;</description></item><item><title>Setting the value of a date field in a repeating table equal to the field in the main data source in code using InfoPath 2003.</title><link>https://www.infopathdev.com:443/forums/thread/38331.aspx</link><pubDate>Wed, 11 Feb 2009 17:06:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:38331</guid><dc:creator>JermaineCross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/38331.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=38331</wfw:commentRss><description>&lt;p&gt;I have created a Time Sheet form. When I click on the datepicker to select&amp;nbsp;the beginning date of the week (which is Sunday), I want that date to be place in the first row of the repeating table. When I reference the field which is (XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:MainSelectionWeekOf&amp;quot;) it brings back a date of 12/31/1969 which of course is not the date selected. I need this date to populate the rest of the weekdays and dates. I am using a SQL data connection. As I was researching I found that someone create a SetNodeValue function on the Expense Report template but when I tried it of course it do not work for me. I need help I have been struggling with this for 2 weeks now and I am heading towards my project deadline. Thanks in advance for assistance.&lt;/p&gt;</description></item></channel></rss>