How are you storing your task type and number of days for due date? In a list?
I also want to add to question. Do you want to do these calculations on the form, which it seems you want to do, or can this be calculated in the workflow?
Hi Francois, Cassy,
The calculation should be on the form, so the user can see it when selecting the task type.
The number of days for the task is calculated in the form (with IF function), the value is stored in a variable.
The Due Date should be Current Date + VarDays - weekends. The problem is how the form knows which days are weekends.
So just to understand correctly, you are using form variables? Can you share a screenshot of your formula?
Yes, but its only for giving a number per task type, no problem with that. The problem is I dont know how to calculate a due date that exclude weekends.
Basically I need a formula or javascript that can calculate due date with business days only.
I have current date, I have number of days for each task, but I dont have a way to exclude weekends for a correct due date.
I am working through this right now as well, wanting for it to calculate on the form alone.
I am using Nintex Forms for O365.
I've taken a look at this: https://community.nintex.com/message/38966 -- isn't quite there.
Here's a request in User Voice for this functionality: https://nintex.uservoice.com/forums/218291-3-nintex-workflow-for-office-365/suggestions/6497549-calculate-work-days-inline
Also, here's a full article on how to achieve it but wow, look at all the work it requires: http://softlanding.ca/blog/advanced-nintex-form-design-calculating-days-off-excluding-weekends-and-holidays-(2)
Will let you know if I figure anything out.
Good day Robert,
I played around in Excel and managed to calculate it with some of the basic Excel formulas. The only problem that you might have is with the INT-formula that converts a value to integer. I could not see this formula in the Nintex inline formulas on the form. But if you know that you always have 7 business days to complete the task, you can replace the weekend days formula with a value of 2, or
0 - 4 days = 0
5 - 9 days = 2
10 - 14 days = 4, etc.
And where I used the Weekdays = 1 or 7 you will have to use the Nintex Formatdate(Date,ddd)= Sun or Sat formula.
Is this what you are looking for? Please let me know if this is not the case.
Hi Rhia,
I have seen all of this links too and more, unfortunately neither is what I need.
The closest I got is the javascript from this article can calculate the business day: Nintex Forms - Business Days Validation - Vadim Tabakman
The problem that it works an opposite way, so it gives you the business days between two days. What I need is to calculate the business days and based on that the result should be the due date.
The "saint grail" is inside the JavaScript, I am just not at that level to modify it the way I need.
Hi Francois,
Thank you for going after my problem so deeply, this is actually working!
I managed to replicate the INT formula with using substring:
subString((BusinessDaysToComplete/5), 0, 1)*2 |
Pls add this to your answer so others can see it in the resolution after I mark it as "right answer".
Robert
Ah, & -- this is great. And, looks like I was close -- I started playing around with logic but I wasn't quite there... I was trying (TotalDays/7)*2 but I couldn't figure out how to ensure that the number rounds down...
This is something you may want to blog about after testing!
And if you aren't the blogging types, let me know, and I'll blog it for the community (and credit you of course.)
Rhia
Great job Robert,
Glad you got it working.
Will test it now for some days, to be sure it works all around.
If wont blog it than I will.
This will easy the life of many people for sure
Go for it Robert. You can blog it.
Francois Crous or Are the calculations in Excel or Nintex working as expected for you? Looks like it works only some of the time?
Examples of results in Excel
(Note: Dates in mm/dd/yyyy format)
Using the Roberts example:
Start Date = 03/02/2017
Business days to complete = 7
Estimated date = 3/13/2017 (Correct)
BUT
Start Date = 03/02/2017
Business days to complete = 3
Estimated date = 3/06/2017 (Incorrect)
Or more current examples:
Start Date = 03/31/2017
Business days to complete = 1 or 2 or 3
Estimated date = 4/3/2017 (Correct only for 1)
Start Date = 03/31/2017
Business days to complete = 4
Estimated date = 4/4/2017 (Incorrect)
Start Date = 03/31/2017
Business days to complete = 5
Estimated date = 4/7/2017 (Correct)
Start Date = 03/31/2017
Business days to complete = 6
Estimated date = 4/10/2017 (Correct)
Start Date = 03/31/2017
Business days to complete = 7
Estimated date = 4/10/2017 (Incorrect)
etc...
Hi Damien,
After a week I realized that it works only in certain cases, so not a "universal" solution. But as I have only limited scenarios it is working for them with some modifications.
Still need to find a way to make it work in all possible cases (due dates).
Thanks Robert. Yes, I came to the same conclusion myself but like you, I used a similar method to the one above to solve for my limited use case where I'm always adding the same number of business days.