Calculating Age in the Legacy Builder

Have more questions? Submit a request

Using the New Builder?

Calculating Age in the Builder

Configure fields in your form to automatically calculate age by subtracting birth date from the current date.

Calculate Age

It involves a little bit of creative Form Builder work on the front-end but will do all the work for you when completing a submission.

  1. Add a Date field to your form, and name it "Current Date." Leave the Default Value as the Current Date, but feel free to uncheck the Mobile Visible checkbox, under the More drop down, to hide the field on mobile.LB_Calculate Age 1.png
  2. Add a second Date field, and name it "Date of Birth." This time, select No Default (Blank) as the Default Value. Leave this field as Mobile Visible.LB_Calculate Age 2.png
  3. Add a Calculation field to your form and name it "Age in Hours." Select Create Calculation, and set up "Current Date" as Operator 1 and "Date of Birth" as Operator 2.LB_Calculate Age 3.png
  4. Select subtraction as the function and Done. Uncheck Mobile Visible to keep this field from unnecessarily cluttering your form.LB_Calculate Age 4.png
  5. Add another Calculation field to your form and name it "Age in Days." This time when setting up the calculation, select "Age in Hours" as Operator 1, then delete Operator 2.
  6. Select New Operator, and choose Constant. Type in "24" as the constant, and select division and Done. Hide this field on mobile as well.LB_Calculate Age 5.gif
  7. Add one more Calculation field and name it "Age in Years." Select "Age in Days" as Operator 1, and follow step 6 to add a constant of "365.25" for Operator 2 (the .25 takes leap years into account). Select division and Done. Leave this visible on mobile.LB_Calculate Age 6.png
  8. The Calculation field will default to 2 decimal places. It will automatically round up when there are 0 decimal places allowed, so allow at least 1 decimal for better accuracy. For example, a 26.6 output would be considered 27 without decimal places.

Save and Publish to device to test it on mobile.

Despite all the invisible supportive fields doing calculations in the background, the goal is for the form to still be clean and easy to read.

Did we answer your question?

Please let us know by voting below. All we ask is if you downvote, please let us know how the content can be improved in the comments!

Articles in this section

Was this article helpful?
1 out of 1 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.