How can I calculate the number of weeks between the selected dates in the Dates Difference Widget?

  • max123jot
    Asked on January 12, 2018 at 7:20 PM

    I would like to use the dates difference widget to calaculate the difference in weeks between two dates

    I have set up a field 

    Calculate Boy's Adjusted Gestational Age:

     I have watch the tutorial on jot form, but sorry I still don’t get it

    I made a condition for this which is probably incorrect

    Would you please advise

    perhaps you would like this as a seperate request, but ...
    Also how to narrow the space available for the input field
    mr#
    which extends past the form

    thanks

    max

  • Support_Management Jotform Support
    Replied on January 13, 2018 at 1:22 AM

    Since you didn't give any specifics and you only mentioned you wanted to count the number of weeks between the two dates, I came up with this demo form:

    https://www.jotform.com/80120601643947

    This doesn't use any conditions - What it utilizes is the FORM CALCULATION WIDGET. To apply this same idea to your form, here's what you need to do:

    1. Add a FORM CALCULATION WIDGET to your form.

    How can I calculate the number of weeks between the selected dates in the Dates Difference Widget? Image 1 Screenshot 30

    2. Setup the form calculation widget as follows:

    How can I calculate the number of weeks between the selected dates in the Dates Difference Widget? Image 2 Screenshot 41

    The idea is to add the DATES DIFFERENCE WIDGET > divide it by 7 > then append the word "weeks" at the end if necessary. It's also recommended to set the field as READ ONLY.

    Related guide: How-to-Perform-Form-Calculation-Using-a-Widget 

    perhaps you would like this as a seperate request, but ... Also how to narrow the space available for the input field mr# which extends past the form

    You're correct - This should have been posted as a separate question so I took the liberty of moving it to a separate thread:

    https://www.jotform.com/answers/1348191

    We'll reply to you there shortly.

  • max123jot
    Replied on January 13, 2018 at 9:43 AM
    thanks
    but i am clearly doing something wrong
    because i believe i have followed instructions in the clear video you gave
    but the form calculation is not working for me
    please advise
    ...
  • TREVON
    Replied on January 13, 2018 at 3:29 PM

    I have checked on of your form (not sure if its the exact one you used to test solution provided by my colleague) and I see the for dose not have "Form Calculation" as demonstrated earlier to you.

    In order to see the exact calculation made on the form I would recommend you clone the form and test and see how the calculations have been done. Below is a guide on how to clone forms. Kindly clone the form https://form.jotform.com/80126227911955 and feel free to test or use it.

    https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL

    In a nutshell what my colleague dis was setup two date picker elements. He then added a "form calculation" widget which will be used to calculate difference between the selected dates.

    In the calculation widget what happens is first date value is recorded then second date value recorded is subtracted from the first date and the difference is divided by 7 to get the number of weeks between the two dates.


  • max123jot
    Replied on January 13, 2018 at 4:43 PM
    https://www.jotform.com/build/62703385659162
    somehow this form id was not provided
    i apologize
    i did follow the instructions as best as i could
    would you please have a look at this form
    it does contain the date difference widget and form calculation widget
    please advise
    thanks
    m
    ...
  • Support_Management Jotform Support
    Replied on January 13, 2018 at 6:24 PM

    Apologies for the confusion. I checked your form and you have added a FORM CALCULATION WIDGET. However, the field you added "inside" that widget was incorrect. You added "Adjusted Gestational Age (# weeks born before EDD)" inside "Adjusted Gestational Age (# weeks born before EDD)" that's why it's not working.

    You should add this field:

    Calculate Boy's Adjusted Gestational Age

    And not this field:

    Adjusted Gestational Age (# weeks born before EDD)

    How can I calculate the number of weeks between the selected dates in the Dates Difference Widget? Image 1 Screenshot 20

  • max123jot
    Replied on January 13, 2018 at 8:43 PM
    BRILLIANT!
    ...