Thanks again for help with my first issue everybody! Round two...DING!
So I inherited this form from another "programmer" but I'm not tracking on some of the stuff. Basically a co-worker said, "Oh, that...yeah he found that on google. I have no idea what it means..." Yup, that's about as much light I can shine on it too. Substring madness is making my head explode. And what is floor()?
Here's the example. We have 4 date fields that work in tandem
LeaveStartDate - Whatever day you start leave
LeaveEndDate - Leave Start Date + 14 days (for a theoretical 15 days leave) It's always 15 days, we're in the military, it's for rest and relaxation while deployed.
TravelDate - This is 2 days before your Leave Start Date
LeaveReturnDate - This is 3 days after your Leave End Date
So, I enter the leave start date and the adddays() function works pretty well, so Leave End Date gets populated. Very nice.
However, Travel Date should be calculated (with a rule?), so adddays(LeaveEndDate, -2) should work, right? Wrong. NaN is the result. Which I assume is not a number, because adddays is for adding, not subtracting. Maybe I could get it to do it though, or maybe someone could tell me how.
Currently the unchecked rule for Travel Date is this:
-conditions: TRAVELDATE is not blank and LEAVESTARTDATE is not blank
-Set a field's value TRAVELDATECHECK (by the way, I have no idea where this field is (TRAVELDATECHECK, so I have tried TRAVELDATE in this position (or ".") and it still doesn't work. I'm assuming it worked at some point.)
-(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)
And then the ReturnFromLeave field I thought for sure would work with adddays(LEAVEENDDATE, 3), but it doesn't. I also get NaN.
Additional info: I have Studio 2008 on my computer, but I do not know why I can't open up code on stuff. 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: "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."
If I can do this without programming it would be good, but at this point anything to get this thing working would be better.
Thanks!
Joe