Can I calculate the Age and populate a value to another field in Jotform Tables?

  • Step_Onward
    Asked on May 8, 2024 at 4:28 PM

    Hi,

    I have a formula on our application form to calculate age and have that age showing up in the submissions table as well. 2 questions on this:

    1. I thought I submitted a request awhile back where someone told me to do the calculation in the table, not the form, but I'm not finding this to remember why. I think it's working OK in the form, but wanted to verify this is ok.
    2. I have a chart showing different demographics for our non-profit, but would like to report ages by groups, but don't see where to do that. Ideally, it would be:
    3. 0-17
    4. 18-35
    5. 36-54
    6. 55+

    Thanks for your help!

    Kris

  • Mafe_M JotForm Support
    Replied on May 8, 2024 at 5:12 PM

    Hi Step_Onward,

    Thanks for reaching out to us for help. Sure, you can calculate the Age and Age Group automatically on your form. Let me show you how:

    • In Form Builder, click on the Add Form Element menu on the left side of the page. 
    • Scroll down and add the Date Picker field to enter the Date of Birth.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 1 Screenshot 80

    • To save the current date, add one more Date Picker field.
    • Click on the Gear icon near the second Date Picker and under the Options tab, select the Current value as Default Date.
    • Then, right-click on the second one and click on Hide.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 2 Screenshot 91

    • Now, open the Add Form Element menu again, and Under the Widgets tab, add the Form Calculation widget.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 3 Screenshot 102

    • Enter the formula below:

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 4 Screenshot 113

    • As the last field, instead of using a dropdown menu, circle back to the Add Form Element menu and add a Short Text field to save the Age Group. As another option, in the Short Text Properties window, under the Advanced tab, set it as Read-Only to stop it from changing manually.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 5 Screenshot 124

    • To populate the last field automatically, click on the Settings tab in the orange navigation bar at the top of the page.
    • In the menu on the left side of the page, click on Conditions.
    • Now, use the Update/Calculate Field element to create conditional rules for each Age Group.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 6 Screenshot 135

    • Set your conditions similar to the condition below:

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 7 Screenshot 146

    Give it a try and let us know if you have any other questions.

  • Step_Onward
    Replied on May 9, 2024 at 1:31 PM

    Hi Mafe,

    Thanks for that information. I do have the Date of Birth field set up, as well as the age field working. I'm using the age based on the application date, not the current date (see my formula below). I used 365 days, not the 360 in your screenshot??

    I have verified I have everything set up like you have above, but I'm seeing:

    1. 50-64 populates by default, even when creating a new entry.
    2. This field is editable, even though I have it set to read only. Nothing is in the default value (see below).

    Screenshots below of my conditions and the field.

    My other question:

    1. If I create the age group on the form and not the table, it does not populate the table, so is it possible to create this age group on the table directly? I do not see that I can do that with all the conditions etc....??
    2. If I can't create the age group directly on the table, so it updates all of the existing entries, does that mean I have to go through and make an edit to each form to make it recalculate? Is there an easier way to force it to do this?

    Thanks for your help!

    Kris

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 1 Screenshot 40

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 2 Screenshot 51

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 3 Screenshot 62

  • Mafe_M JotForm Support
    Replied on May 9, 2024 at 2:29 PM

    Hi Kris,

    Thanks for getting back to us.  I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.

    Thanks for your patience.

  • Mafe_M JotForm Support
    Replied on May 9, 2024 at 8:52 PM

    Hi Kris,

    Thanks for patiently waiting. In order to achieve your requirement, what you can do is add four short answer fields for the age group. Each short answer field has a default value of the age group and is set to read only. After that, create a show/hide conditional logic that once age is calculated, the appropriate age group will show up. Let me show you how to set it up:

    I. Add four short answer fields with default value and is set to read-only.

    1. ln Form Builder, click Add Form Element on the left-hide of the page.
    2. Drag and drop the short answer fields in your form.
    3. Click the gear icon and go to Advanced tab and set Default Value to Age Group.
    4. Toggle the slider to ON for Read-Only Option.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 1 Screenshot 70

    II. Set up a show/hide condition that will show the age group depending on the age.

    1. In Form Builder on the orange navigation bar, click Settings.

    2. Go to Conditions tab and Click Add New Condition, then select Show/Hide Fields.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 2 Screenshot 81

    3. Set up a condition like ones below.

    4. Click Save to apply the changes.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 3 Screenshot 92

    Here is the demo form I used. You can clone the form using the form URL so that you can check on how it is implemented. Cloning your forms using a form URL is easy to do. Let me walk you through it:

    1. Open your My Forms page and click on Create Form on the left side of the page.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 4 Screenshot 103

    2. In the window that opens up, click on Import Form

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 5 Screenshot 114

    3. In the next window, click on From a Webpage

    4. Paste the form link into the Enter URL field and click on Create Form.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 6 Screenshot 125

    After cloning your form, it will open up in Form Builder automatically. Now, you can edit the way you want it and publish it.

    Give it a try and let us know if you need any more help.

  • Step_Onward
    Replied on May 10, 2024 at 12:05 PM

    Thanks for this info, Mafe. I really appreciate you sending me all the detail, screenshots and demo form and will undo all of the previous steps from earlier and work on implementing this.

    I still have these couple of questions:

    1. If I create the age group on the form and not the table, it does not populate the table, so is it possible to create this age group on the table directly? I do not see that I can do that with all the conditions etc....??
    2. If I can't create the age group directly on the table, so it updates all of the existing entries, does that mean I have to go through and make an edit to each form to make it recalculate? Is there an easier way to force it to do this?


    Thank you!

    Kris

  • Angeli JotForm Support
    Replied on May 10, 2024 at 12:41 PM

    Hi Kris,

    Thanks for getting back to us. I’ll need a bit of time to look into this. I’ll get back to you shortly.

    Thanks for your patience, we appreciate it.

  • Angeli JotForm Support
    Replied on May 12, 2024 at 9:55 AM

    Hi Kris,

    We really appreciate your patience and understanding while we’re looking into this. For your first question, when you say Table, do you mean the submission Table? If so, yes, you can calculate the Age there, but you can't create the conditions to populate the result on another field in the Jotform Tables. So you will have to do it in the form.

    As for the second one, yes, you need to edit each submission for the Age Group value to populate. But, I noticed that your condition is not properly configured, that's why it's showing an incorrect Age Group. You'll have to change the below conditions from 'Any' to 'All'. Take a look at the screenshot below:

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 1 Screenshot 30

    Let me show you how:

    1. Click the Pencil icon and change the IF condition from ANY to ALL.

    Can I calculate the Age and populate a value to another field in Jotform Tables? Image 2 Screenshot 41

    Give it a try and let us know if you need any other help.

  • Step_Onward
    Replied on May 13, 2024 at 2:40 PM

    This works. I completely missed the Any/All setting! Thanks for your help!

 
Your Answer