Calculating business days between two dates - Annual Leave Request - 50% solution here!!

  • 4 August 2016
  • 6 replies
  • 16 views

Badge +2

I, like many others on this forum, am trying to calculate the number of business days (non-weekends, non-holidays) between two date on a Nintex Form.

I've found the following article that begins to go an excellent job of explaining exactly how to do this. However, I find myself getting stuck around the advanced steps ("

Advanced Steps - Counting Weekends And Holidays")

I'm unsure how/where to use the Javascript as Jeff is suggesting in the article.

The article can be found here: Advanced Nintex Form Design - Calculating Days Off Excluding Weekends And Holidays (2) : Softlanding, Vancouver, BC

Any assistance on this would be much appreciated!

Many thanks,

Bobby


6 replies

Userlevel 5
Badge +14

hm, it's described in chapter 'Advanced Steps - Attaching Custom Events To Nintex Date Pickers'.

so what's exactly not clear on that?

Badge +2

This is the stage that I think is vague - I'm not sure how or where to apply the "asynchronous event" or what/how to "hijack" the stack...:

The next step is to attach the functions in the scripts to our date picker controls. This is so that when a user selects dates from the popup calendar, an asynchronous event fires and attempts to retrieve the number of weekends and holidays and update the days column appropriately.

To do this, we have to modify the default date picker controls and append our function calls to it's onSelect attribute. After some digging around, I found that the date picker control is initialized by Nintex by taking the nfFillerLoadFunctions stack and popping the first item out, which contains the function to create date picker objects.

Therefore, we can 'hijack' this stack by popping out and discarding the default date picker control, and then inserting our own:

Badge +2

Marked as answered in error. No answer found yet.

Userlevel 5
Badge +14

you can take whole block of code below the text and copy&paste it to the same script file DateFunctions.js

Badge +2

Thanks - I've done that but am unsure how to modify the default date picker to reference the js file?

Userlevel 5
Badge +14

you need not to do anything, it's modified by the code

Reply