- mojo30Asked 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?
- JotForm SupportjonathanAnswered on September 27, 2014 at 07:06 PM
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.
- mojo30Answered on September 27, 2014 at 07:51 PM
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?
- JotForm SupportjonathanAnswered on September 27, 2014 at 09:28 PM
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.
- mojo30Answered on September 28, 2014 at 01:05 AM
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!! :)
- JotForm SupportjonathanAnswered on September 28, 2014 at 02:24 AM
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.
- mojo30Answered on October 05, 2014 at 04:30 PM
Hi. Any word on the demo jotform that does the idea?
- JotForm SupportTitusNAnswered on February 08, 2016 at 10:19 PM
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.