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.
How do I use the result of the Driving Distance widget in a calculated field?Asked by mojo30 on September 27, 2014 at 02:38 PM
I'm trying to use the driving distance result (in miles) and multiply it by a number, but the result comes back as the distance and duration in a concatenated form/array.
How do I just pull out the distance alone?
distance widget duration calculate distance
If I understand correctly, you are trying to add calculation to the Distance result of the Driving Distance Widget right?
From that look of it, I think you cannot do this using the Driving Distance widget result.
Because the Distance result is a Read-Only static data -- meaning it does not have data source or repository where you can get the output and use it for another purpose/calculation.
What I think you can do instead is use the Calculation Widget to calculate Distance.
The output of the Calculation widget can then be used as data (i.e. for another calculation)
Check this Fuel Calculator template. I think this is similar to what you were looking for.
Hope this help. Inform us if there is more we can help you with.
Thanks for the response. Actually, I'm just looking to have the Distance result be only the distance value. As you can see by the example above, the Distance field on the right has both the distance and the duration numbers concatenated together. I just want the distance result. (2999 in the example above. I want the 119 to not be there)Any thoughts?
Thank you for explaining that. I was able to understand more about it.
From what I see in the value of Distance the 119 is indeed a the value of Duration which was concatenated to the Distance calculated.
The only way we can trim the Distance value (that is exclude 119 from Distance calculated) is by using the form's full source code. And add a custom script that will split or trim the concatenated Distance value.
Will you be able to use the full source code and embed it to your own website? We can assist you with the custom code to use to achieve this.
Yes, I can use the full source code in my site, and I would very much appreciate the custom script!! Thank you for all your help!! :)
Thank you for the confirmation.
I'll get back to you with a demo jotform that does the idea.
I'll update you as soon as I can.
Hi. Any word on the demo jotform that does the idea?
I know this has been a while - but I'll update you anyway.
The widget was fixed to output the correct distance data - for instance - this form:
You can capture the distance using the Form Calculator.
Please check it out - and let us know if you have any questions.