Add working days to datepicker field in infopath 2010

Hello experts,

How can I add working days in a given datepicker field in infopath 2010 and the result will be calculated in a second datepicker field as a calendar day, including weekends, without writing code?

Who is Participating?
klafkasConnect With a Mentor Commented:
The infopath form contains 3 basic fields, absence_days (integer), start _date (date picker) and   end_date (date picker).
There are also 3 additional hidden fields (all integer type) called f1 ,  f2 and f3.
The F1 field stores the number of the day of the week.
The F2 field stores the remain days of the week
The F3 field stores the total of the absence days including weekends if exists.
Several action rules are applied when the field star_date changed.
1.      Set value to F1 field  XPath mode
(number(substring(., 9, 2)) + floor(((153 * (number(substring(., 6, 2)) + (12 * floor((14 - number(substring(., 6, 2))) div 12)) - 3)) + 2) div 5) + (365 * (number(substring(., 1, 4)) + 4800 - floor((14 - number(substring(., 6, 2))) div 12))) + floor((number(substring(., 1, 4)) + 4800 - floor((14 - number(substring(., 6, 2))) div 12)) div 4) - 32039) mod 7

2.      Set value to F2 field  XPath mode
7 - ../my:F1
3.      Set value to F3 field XPath mode
../my:AbsenceDays - 1 + floor((../my:AbsenceDays + 5 - ../my:F2) div 5) * 2
4.      Set Value to End_Date field
xdDate:AddDays(., ../my:F3)
WHat do you mean without writing code?

Even adding 1 working day is difficult since if the next day is non-working you have to add 2 days then check again.

Do you need to worry about holidays?

GeorgegianAuthor Commented:
Hi mlmcc,

I mean that, is there a custom function that calculates the calendar day by adding working days is a given date? Custom function that uses Infopath object and functions and not code written in any other language like VB or C etc.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

GeorgegianAuthor Commented:
Hi mlmcc

Regarding holidays, this custom function calculates only working days and ignores holidays.

I know of some in VB.  I am not an InfoPath programmer so have no knowledge there.

Is this at all useful?
It is code but not in a language I recognize.

Basic algorithm it uses is to calculate the number of weeks (5 days in a business week) and the number of days remaining.  it then adds the days one at atime ensuring the day added is a business day

GeorgegianAuthor Commented:
Thanks klafkas,

i test your solution and it works.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.