Skip to main content
Nintex Community Menu Bar

Auto calculate Age from Date of Birth date field

  • December 4, 2019
  • 1 reply
  • 120 views

Forum|alt.badge.img+4

Got to the bottom of this one with @EuanGamble  so thought it worth sharing.

 

My form has a Date control to capture Date of Birth and I wanted to auto calculate the age rather than have the end user fill it in. How did we (and I say we, it was a team effort) do it:

Start by creating a variable:
Use the Function dateDiff then add the form control for Date of Birth followed by Context value Current Date. Variable looks like dateDiff("TotalYears",[Form].[DateofBirth],[Context].[Current date])5794i5F3BF29CC8576DB5.png

 

I then need to create a rule to ensure my Age control is populated when I input the DOB.

If Date of Birth is filled, then Age value is <my variable>.5795i1B282350B6F53518.png

 

Finally, set my Age control to read only on the form...5796iEF86147C4923E2E2.png

 

And when I put my date of birth in it shows:5797i422405B63F88B7D9.png

 

1 reply

EuanGamble
Nintex Employee
Forum|alt.badge.img+13
  • Nintex Employee
  • December 4, 2019

Glad you had success with New Responsive Forms, @cgellis ?