<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Issue relsoved---read solution here---PrRe: Using Date Picker input to return a whole number</title><link>https://www.infopathdev.com:443/forums/thread/80432.aspx</link><pubDate>Wed, 11 Jul 2012 12:04:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80432</guid><dc:creator>earlkmi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80432.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=80432</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello Hilary--&lt;/p&gt;
&lt;p&gt;I was hoping you can assist me with building this process.. I have 2 parts built: todays date and date initiated:&amp;nbsp; I am at a loss for part 3, the retunr value: Total number of days (number format)&lt;/p&gt;
&lt;p&gt;I think I may be having similar issues pertaining to &amp;#39;date difference&amp;#39; requirements.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m trying to have a field return the total number of days (number format-not date)&amp;nbsp; from 2 separate date values:&amp;nbsp; (Todays date - date initiated)&lt;/p&gt;
&lt;p&gt;total number of days = (todays date - date inititiated)&lt;/p&gt;
&lt;p&gt;todays date will always be greater than (after the date initiated)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Solution for my issue with dates is listed below:&amp;nbsp; &lt;a href="http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm"&gt;http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!&lt;/h1&gt;
&lt;div id="author"&gt;
&lt;p&gt;by &lt;a href="http://www.bizsupportonline.net/about-sym-wong-a-ton-infopath.htm"&gt;S.Y.M. Wong-A-Ton&lt;/a&gt; | Applies to: &lt;a href="http://www.bizsupportonline.net/infopath2007/index.htm"&gt;InfoPath 2007&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p class="description"&gt;Use rules, conditions, and the number(), floor(), and substring() functions in formulas to calculate the difference between two date picker controls in InfoPath.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;PADDING-LEFT:5px;PADDING-RIGHT:0px;FLOAT:right;PADDING-TOP:0px;" class="ad"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;
&lt;h2&gt;Problem&lt;/h2&gt;
&lt;p&gt;You have a form template with two &lt;a href="http://www.bizsupportonline.net/infopath-date-picker.htm"&gt;InfoPath date picker&lt;/a&gt; controls and you would like to calculate the difference between the two date picker controls without writing code.&lt;/p&gt;
&lt;h2&gt;Solution&lt;/h2&gt;
&lt;p&gt;Use rules, conditions, and the &lt;strong&gt;number()&lt;/strong&gt;, &lt;strong&gt;floor()&lt;/strong&gt;, and &lt;strong&gt;substring()&lt;/strong&gt; functions in formulas to calculate the difference between two date picker controls in InfoPath. &lt;/p&gt;
&lt;h2&gt;Discussion&lt;/h2&gt;
&lt;p&gt;You can accomplish this functionality as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Design an InfoPath form template as shown in figure 1 with two &lt;strong&gt;Date Picker&lt;/strong&gt; controls named &lt;strong&gt;startDate&lt;/strong&gt; and &lt;strong&gt;endDate&lt;/strong&gt;, and one &lt;strong&gt;Text Box&lt;/strong&gt; control named &lt;strong&gt;difference&lt;/strong&gt;. &lt;br /&gt;&lt;img border="0" src="http://www.bizsupportonline.net/infopath2007/articles/images/200710272044.png" width="300" height="146" alt="" /&gt; &lt;br /&gt;&lt;font size="2"&gt;&lt;strong&gt;Figure 1. InfoPath form template in Design mode.&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;The Main data source of the InfoPath form template should resemble the following figure: &lt;br /&gt;&lt;br /&gt;&lt;img border="0" src="http://www.bizsupportonline.net/infopath2007/articles/images/200710272045.png" width="125" height="119" alt="" /&gt; &lt;br /&gt;&lt;strong&gt;Figure 2. The Main data source of the InfoPath form template.&lt;/strong&gt; &lt;/font&gt;&lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;startDate&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: 
&lt;div class="codecontainer"&gt;&lt;code&gt;(number(substring(../my:endDate, 9, 2)) + floor((153 * (number(substring(../my:endDate, 6, 2)) + 12 * (floor((14 - number(substring(../my:endDate, 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) * 365 + floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 4) - floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 100) + floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 400) - 32045) - (number(substring(., 9, 2)) + floor((153 * (number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) * 365 + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 4) - floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 100) + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 400) - 32045) &lt;/code&gt;&lt;/div&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is not blank&lt;/em&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is not blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add a second &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;startDate&lt;/strong&gt; field with the following settings: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is blank&lt;/em&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;endDate&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: 
&lt;div class="codecontainer"&gt;&lt;code&gt;(number(substring(., 9, 2)) + floor((153 * (number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) * 365 + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 4) - floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 100) + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 400) - 32045) - (number(substring(../my:startDate, 9, 2)) + floor((153 * (number(substring(../my:startDate, 6, 2)) + 12 * (floor((14 - number(substring(../my:startDate, 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) * 365 + floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 4) - floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 100) + floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 400) - 32045) &lt;/code&gt;&lt;/div&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is not blank&lt;/em&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is not blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add a second &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;endDate&lt;/strong&gt; field with the following settings: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is blank&lt;/em&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;difference&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;.&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Condition&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;difference does not match pattern Custom Pattern: -{0,1}\d+&lt;/em&gt; &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;You should now have a fully functional InfoPath form that will calculate the difference between the dates soon after you have entered valid dates. This solution also works for InfoPath 2003 form templates and InfoPath 2007 browser-enabled form templates. &lt;/p&gt;</description></item><item><title>Re: Using Date Picker input to return a whole number</title><link>https://www.infopathdev.com:443/forums/thread/29545.aspx</link><pubDate>Fri, 20 Jun 2008 14:48:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29545</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29545.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29545</wfw:commentRss><description>&lt;p&gt;Hi, Vigher:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;InfoPath doesn&amp;#39;t have a date difference function, which is what you will need to get the difference between two dates. Here is a link to another post on this forum that has a code sample as well as a link to a tutorial on another site: &lt;a href="http://www.infopathdev.com/forums/p/3604/12772.aspx#12772"&gt;http://www.infopathdev.com/forums/p/3604/12772.aspx#12772&lt;/a&gt;. Since it will require some code to get your date difference, you may want to incorporate your conditions in the code, and attach it to the Changed event for SalesDate.&lt;/p&gt;</description></item><item><title>Using Date Picker input to return a whole number</title><link>https://www.infopathdev.com:443/forums/thread/29393.aspx</link><pubDate>Fri, 13 Jun 2008 20:37:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29393</guid><dc:creator>Vigher</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29393.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29393</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m trying to return a whole number value and having a bit of trouble&lt;/p&gt;
&lt;p&gt;SalesDate = Date Picker field&lt;br /&gt;PermitDate = Date Picker filed&lt;/p&gt;
&lt;p&gt;when i enter the following formula&amp;nbsp;into a field called SalesAging&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;today() - SaleDate&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; I recieve a NaN value.&amp;nbsp; I&amp;#39;d also like to incorporate conditions, where PermitDate = null and SalesDate != null&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Any help with this would be greatly appreciated.&lt;/p&gt;</description></item></channel></rss>