How do I use the result of the Driving Distance widget in a calculated field?

  • mojo30
    Asked on September 27, 2014 at 2: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?

  • jonathan
    Replied on September 27, 2014 at 7:06 PM

    Hi,

    If I understand correctly, you are trying to add calculation to the Distance result of the Driving Distance Widget right?

    How do I use the result of the Driving Distance widget in a calculated field? Image 1 Screenshot 20

     

    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.

     

     

     

     

     

     

     

  • mojo30
    Replied on September 27, 2014 at 7: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?
  • jonathan
    Replied on September 27, 2014 at 9: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.

    How do I use the result of the Driving Distance widget in a calculated field? Image 1 Screenshot 20

     

    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.

    Thanks.

     

     

     

     

     

     

  • mojo30
    Replied on September 28, 2014 at 1: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!! :)

  • jonathan
    Replied on September 28, 2014 at 2: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.

     

  • mojo30
    Replied on October 5, 2014 at 4:30 PM

    Hi.  Any word on the demo jotform that does the idea?

     

  • TitusN
    Replied on February 8, 2016 at 10:19 PM

    Hello,

    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: 

    http://form.jotformpro.com/form/43073792828969?

    You can capture the distance using the Form Calculator

    Please check it out - and let us know if you have any questions.