<?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>Re: Date calculations...add days() is good...but what about subtract days()?</title><link>https://www.infopathdev.com:443/forums/thread/77437.aspx</link><pubDate>Wed, 11 Apr 2012 12:11:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77437</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77437.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=77437</wfw:commentRss><description>&lt;p&gt;I think you need to ensure that your logic is set up so that rules fire in the right order, e.g. that you don&amp;#39;t use addDays(&lt;u&gt;field&lt;/u&gt;, number) when &lt;u&gt;field&lt;/u&gt; is still blank.&amp;nbsp; I think that if you use default value formulas for everything this will probably work out without too much finagling.&lt;/p&gt;</description></item><item><title>Re: Date calculations...add days() is good...but what about subtract days()?</title><link>https://www.infopathdev.com:443/forums/thread/77431.aspx</link><pubDate>Wed, 11 Apr 2012 10:11:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77431</guid><dc:creator>joemacangel</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77431.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=77431</wfw:commentRss><description>&lt;p&gt;K, default value with adddays(LEAVESTARTDATE, -2) works well.&amp;nbsp; Default value was something I learned from my last question and I forgot to try that last night.&lt;/p&gt;
&lt;p&gt;Still tinkering with ReturnFromLeave.&lt;/p&gt;</description></item><item><title>Date calculations...add days() is good...but what about subtract days()?</title><link>https://www.infopathdev.com:443/forums/thread/77429.aspx</link><pubDate>Wed, 11 Apr 2012 09:18:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77429</guid><dc:creator>joemacangel</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77429.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=77429</wfw:commentRss><description>&lt;p&gt;Thanks again for help with my first issue everybody!&amp;nbsp; Round two...DING!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;So I inherited this form from another &amp;quot;programmer&amp;quot; but I&amp;#39;m not tracking on some of the stuff.&amp;nbsp; Basically a co-worker said, &amp;quot;Oh, that...yeah he found that on google. I have no idea what it means...&amp;quot;&amp;nbsp; Yup, that&amp;#39;s about as much light I can shine on it too.&amp;nbsp; Substring madness is making my head explode.&amp;nbsp; And what is floor()?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the example.&amp;nbsp; We have 4 date fields that work in tandem&lt;/p&gt;
&lt;p&gt;LeaveStartDate - Whatever day you start leave&lt;br /&gt;LeaveEndDate - Leave Start Date + 14 days (for a theoretical 15 days leave) It&amp;#39;s always 15 days, we&amp;#39;re in the military, it&amp;#39;s for rest and relaxation while deployed.&lt;br /&gt;TravelDate - This is 2 days before your Leave Start Date&lt;br /&gt;LeaveReturnDate - This is 3 days after your Leave End Date&lt;/p&gt;
&lt;p&gt;So, I enter the leave start date and the adddays() function works pretty well, so Leave End Date gets populated.&amp;nbsp; Very nice.&lt;/p&gt;
&lt;p&gt;However, Travel Date should be calculated (with a rule?), so adddays(LeaveEndDate, -2) should work, right?&amp;nbsp; Wrong.&amp;nbsp; NaN is the result.&amp;nbsp; Which I assume is not a number, because adddays is for adding, not subtracting.&amp;nbsp; Maybe I could get it to do it though, or maybe someone could tell me how.&lt;/p&gt;
&lt;p&gt;Currently the unchecked rule for Travel Date is this:&lt;/p&gt;
&lt;p&gt;-conditions: TRAVELDATE is not blank and LEAVESTARTDATE is not blank&lt;br /&gt;&amp;nbsp; -Set a field&amp;#39;s value TRAVELDATECHECK&amp;nbsp; (by the way, I have no idea where this field is (TRAVELDATECHECK, so I have tried TRAVELDATE in this position (or &amp;quot;.&amp;quot;) and it still doesn&amp;#39;t work.&amp;nbsp; I&amp;#39;m assuming it worked at some point.)&lt;br /&gt;&amp;nbsp;&amp;nbsp; -(number(substring(LEAVESTARTDATE, 9, 2)) + floor((153 * (number(substring(LEAVESTARTDATE, 6, 2)) + 12 * (floor((14 - number(substring(LEAVESTARTDATE, 6, 2))) / 12)) - 3) + 2) / 5) + (number(substring(LEAVESTARTDATE, 1, 4)) + 4800 - (floor((14 - number(substring(LEAVESTARTDATE, 6, 2))) / 12))) * 365 + floor((number(substring(LEAVESTARTDATE, 1, 4)) + 4800 - (floor((14 - number(substring(LEAVESTARTDATE, 6, 2))) / 12))) / 4) - floor((number(substring(LEAVESTARTDATE, 1, 4)) + 4800 - (floor((14 - number(substring(LEAVESTARTDATE, 6, 2))) / 12))) / 100) + floor((number(substring(LEAVESTARTDATE, 1, 4)) + 4800 - (floor((14 - number(substring(LEAVESTARTDATE, 6, 2))) / 12))) / 400) - 32045) - (number(substring(LEAVESTARTDATE, 9, 2)) + floor((153 * (number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) / 12)) - 3) + 2) / 5) + (number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) / 12))) * 365 + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) / 12))) / 4) - floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) / 12))) / 100) + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) / 12))) / 400) - 32045)&lt;/p&gt;
&lt;p&gt;And then the ReturnFromLeave field I thought for sure would work with adddays(LEAVEENDDATE, 3), but it doesn&amp;#39;t. I also get NaN.&lt;/p&gt;
&lt;p&gt;Additional info: I have Studio 2008 on my computer, but I do not know why I can&amp;#39;t open up code on stuff.&amp;nbsp; I installed the special Microsoft Visual Studio Tools for Applications, but whenever I try to open up via the programming menu, it gives me the following error: &amp;quot;Infopath cannot starts MVSTA. Infopath cannot create the Visual Basic or C# project. The locations for the VB or C# project cannot be found or cannot be accessed.&amp;quot;&lt;/p&gt;
&lt;p&gt;If I can do this without programming it would be good, but at this point anything to get this thing working would be better.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Joe&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>