Calculate age

  • ReLivePT
    Asked on June 25, 2020 at 2:02 AM

    Hello,

    I am unable to calculate age using the suggested methods posted in the forums. Form link is below. Please advise. Thanks.

  • Vanessa_T
    Replied on June 25, 2020 at 3:05 AM

    I just tested your form and it works correctly.

    1593068743A Screenshot 10

    Can you please give examples where it is not correctly calculating?

  • Justin
    Replied on June 25, 2020 at 8:20 AM

    Hi, it seems to be calculating now. Do you know why the age calc shows "50" by default when DOB is blank? 1593087536Screenshot 20200625 071432 Chr Screenshot 10

  • Ivaylo JotForm Support
    Replied on June 25, 2020 at 8:45 AM

    It is because the hidden "Days Difference" field has a value even when "Date of Birth" is emtpy. This happens because the hidden "Today" field always has a value.

    So, the "Today" field reflects the "Day Difference" field, which then reflects the "Date of Birth".

    In order to avoid this, you can try to merge the Form Calculation widgets.

    Let us know if you need any further assistance.

  • ReLivePT
    Replied on June 25, 2020 at 11:01 AM

    Can you explain how to merge the calc widgets? I removed the one calc for days difference and just included the floor((Today-Date of Birth)/365.25) in one calc. Thanks.

  • Sam_G
    Replied on June 25, 2020 at 12:24 PM

    Hi ReLivePT,

    Let me work on this and will update you via this ticket.

  • Sam_G
    Replied on June 25, 2020 at 1:58 PM

    Hi ReLivePT,

    Thank you for your patience.

    You may add a condition almost identical to the formula that you have.

    Calculate age Image 10

    Your form should look like this.

    Calculate age Image 21

    Cloned form: https://form.jotform.com/201764601622953

    I hope this helps.

    Let us know if you need further assistance.