I have leave start date , leave end date and duration fields I want the duration field to be automatically calculated from start and end fileds like this (leave end date- leave start date)+1 how can i do this?
Hi
It quite simple. Use create a form rule. You will need to use this formula datediff()
Is the duration field a Text or Number field?
What should the duration be for this example? Start Date (May 1) and End Date (May 4)
4-1 = 3. 3 days or 4 days. You stated that it should be 4.
On your form, insert the Start Date (Date), End Date (Date) and the duration fields.
Create a new Form Rule.
Add 2 conditions - Start Date is filled AND End Date is filled.
Add the THEN outcomes.
Set Duration field (Number type) to the value of the formula
dateDiff("TotalDays",DForm].FStart Date],DForm].FEnd Date])
If you need to add 1 more day…
dateDiff("TotalDays",aForm].,Start Date],tForm].,End Date]) + 1
If the Duration field is Text, you need to add the convertToString() function
convertToString(dateDiff("TotalDays",tForm]."Start Date],rForm].]End Date]))
Summary
Hi
Did this response help solve your question?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.