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.
Time Field: Pass the time range duration to a form calculation?Asked by Rory81 on January 19, 2015 at 11:33 AM
I want to be able to send the Time Range duration that the form calculates to a text field. Or get a work around so ultimately when i generate an excel to work with the data i can get that duration on the spreadsheet. I am not really interested in the start and end time of the range itself as much as in the duration (difference between those times). Is this possible?
Thanks a lot,
If I understood you correctly, you would like your form to calculate the difference between two times (Start and End Times) and send the difference between those two times in your notification email or visible in your report. If this is correct, yes this is achievable with the use of conditional logic.
Here is a test form I have prepared: http://form.jotformpro.com/form/50184649471965
To accomplish what I have done, you can follow the instructions below. If you would like to clone my form and make further modification you can follow this guide.
We will now set the conditional logic statement to update the text box with the difference between the two times.
I hope this helps. Feel free to contact us if further assistance is needed.
Is it possible to send the Time Range Duration from the time field though?
In other words, when you add a time field and enable the "Range" and "Show Time Range Duration" options, is it possible to use the time range duration value in a calculation? It would just be a little cleaner then having 3 fields to accomplish the same result: "Start Time," "End Time," and a number field to calculate the difference.
I'm not sure what you meant by getting the range and the time range duration of your example.
Could you give us an example? From what you mentioned in the first post, you are not really focused on the start and end time difference, which in my case I assume is the range duration or the difference on them.
In your case, we would like to know what would be the variables that will result to a time range duration. If you are looking on how to making a calculation by getting a field value, you can use the Form Calculation widget, here's a guide on that: http://www.jotform.com/help/259-How-to-perform-calculation-in-the-form.
We'll wait for your response.
I wish to pass the TOTAL (2:00) to a calculation. Possible? Thanks for the help!
Unfortunately, it is not possible to pass the time range duration into a field or a form calculation, the only workaround that you can use is using two Time fields and passing their values, that will give you a more dynamic approach and accurate process of calculating and using the time range duration value.
But, I will escalate this to our back end team to see if they can update that "Time" field range value to be used in the conditions and form calculation. Unfortunately, I can't guarantee that this will be implemented or even be considered, I would suggest using the workaround while this is not yet implemented. But we'll update you as soon as we hear any news.
Thank you for your patience and understanding.
Thanks for the help, I'll implement as you suggest for the time being.
Wonderful, thanks! Much cleaner solution for start and stop times.
The time duration field seems to be passing only the digits of the duration.
For example, if the duration is 2 hours and 45 minutes (2:45) the result is 245. Or:
Is it possible to have it in decimals like the other times, ex: 2:45 becomes 2.75?
Thank you for updating us. I'll notify the Nicholas about this problem and we'll update you here in this thread.
Perfect. Thanks for getting that implemented so quickly!
To better assist you, I've opened a separate thread for your concern. Please refer to this link instead: http://www.jotform.com/answers/641705. We will address it shortly.