What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Calculation for particular date is not workingAsked by bmanfield on February 15, 2017 at 07:14 PM
I'm calculating age and a player division classification fields from a DOB field. The Player Division field is conditional on the registration type being 'Player'. The player division classification isn't populating correctly for a DOB 04/01/2002. Days before and after the birthday calculate the Player Division field incorrectly. The player division field is populated based upon a calculation of the person's age in days at the end of the current year. (31/12/2017)
The example form I have provided is an extracted clone of the form with the explicit fields involved.
I've had a look at the conditional logic but cant see anything wrong. Could someone please take a look and tell me what I've missed?
I did check your form and did not find any issue with that. I changed the data and also tested it for 04/01/2002 as well but I am unable to replicate the issue. The conditions seems to work as expected and the data is populated in "Player Division" field. Please check the screenshot below:
I would suggest you to please test your form again and get back to us if the issue persists.
Yeah I've been working on the problem in the form provided which is why the form has changed. I figured out its possibly because of the requirement to account for an extra day in leap year and also because the of the requirement for a filter that allows >= instead of just >. I've recalculated the age thresholds in days based upon 365.25 days per year (eg: 10x365.25 = 3652.5) and rounded it down by .001 to workaround the >= requirement.
Is there a feature to allow =< or >= as a selectable filter?
I don't know if there's a better way to calculate what I'm doing. Any advice is appreciated.
I'm still working on it. :-)
I am not sure if I have understood your requirement correctly. Are you trying to calculate Age in years or in number of days? Is it your requirement to calculate number of days?
There is a better way to calculate age. Here are the steps you should follow:
Here are the steps you should follow:
#1. Add a hidden date field in your form and hide it.
#2. Add another date field which users will use to select data of birth.
#3. Add "Form Calculation" widget in form and add the above formula to calculate age. Please check the screenshot below:
I would suggest you to please take a look at the following form and see if this is what you wanted to achieve: https://form.jotform.com/70194559707970
Feel free to clone this form for a closer look. The following guide should help you in form cloning: https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL
Here is the formula to calculate age:
floor((Current Date - Date of Birth) / 365)
Hope this helps.
Do get back to us if you have any questions.