Skip to main content
Nintex Community Menu Bar
Question

Automatically calculated field

  • April 29, 2024
  • 2 replies
  • 87 views

Forum|alt.badge.img+3

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?

2 replies

Garrett
Forum|alt.badge.img+16
  • Scout
  • April 29, 2024

Hi @Alaa Moussa 

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",[Form].[Start Date],[Form].[End Date])

If you need to add 1 more day…

dateDiff("TotalDays",[Form].[Start Date],[Form].[End Date]) + 1

 

If the Duration field is Text, you need to add the convertToString() function

convertToString(dateDiff("TotalDays",[Form].[Start Date],[Form].[End Date]))

 

Summary

 


MillaZ
Nintex Employee
Forum|alt.badge.img+22
  • Nintex Employee
  • May 6, 2024

Hi @Alaa Moussa 

Did this response help solve your question?