Instructions on how to insert these scripts will be provided later. To subtract weekends from 2 dates, we pass the value from the date fields into a JavaScript function that loops through the dates and checks if it is a weekend, and then returns the number of weekend days. Set the new label’s Name and CSS Class to days like before. We will first replace the dynamic Calculated Value days control with a simple Label control that we can write to. However, the days calculated does not take into account weekends or holidays: We now have a clean looking form that figures out how many days are between 2 dates. The previous steps have been relatively straightforward. Therefore, we can expand our days calculation to default to 0 when any of the date picker fields are empty using the formula If(or(isNullOrEmpty(dateFromPicker), isNullOrEmpty(dateToPicker)), 0, dateDiffDays(dateToPicker,dateFromPicker) + 1)Īdvanced Steps – Counting Weekends And Holidays Also, you cant change the date and time seconds in a form control or. Secondly, lets remove the alternating background color scheme that is applied appears when we have multiple rows in our repeater section:įinally, we notice that the days column defaults as 1, even when there is no dates selected. In automation we come across problems to get or set date in various formats. ![]() So now we have a working form, but we want to polish it up a bit.įirst, lets remove the ugly borders from the repeater section: You should have a working form where you can calculate days between ranges, and see the total number of days: We can also add a total days Calculated Value control with formula sum(days) to the bottom of the repeater section, such that we have this:Īdd a Total Days and Days Off label, clean things up a bit, and then publish or preview the form. It look a little time as I find that jQuery documentation and examples are not as awesome as I’d like them to be. To calculate the days between dates in individual rows, we can use a Calculated Value control with the Name and CSS Class set to days with the formula dateDiffDays(dateToPicker, dateFromPicker) + 1 like so: The aim here is to have one DatePicker control on our Nintex Form, and when you make a change to it, a second DatePicker gets updated with the original date selected, plus 129 days. ![]() See List of form controls to find out more information for each control. Set both the Name and CSS Class of the date pickers to dateFromPicker and dateToPicker. Use form controls to define the fields, labels, and layout of your form. Recording the date ranges is easily done by using a Repeating Section control in the form like so: Let’s jump right into this challenge, and build it step-by-step from scratch! First Steps Here’s how you do it Create your Nintex form and add a Save and Submit button. The solution we came up with used JavaScript and jQuery to do some simple lookups and calculations. In this form, the user must be able to select multiple ranges of dates, and the form must calculate the number of working days excluding weekends and holidays. Recently, we had a client who wanted an interactive form to enter leave request information and dates.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |