Why calculation in the form is not working properly?

  • dotransferme
    Asked on January 25, 2017 at 9:27 AM

    Hello,

     

    We have field on form https://form.jotform.me/70242331183445 in section where customer can select: One Way or Round Trip 

    If customer select round trip we have add following formula to double the total price of transfer:

     

     

    And it works! BUT, when One way is selected (after checking Round Trip) the total price in price field disappears!

     

    Please assist us to solve this problem!

    In ideal, when Round Trip is selected it must double the total sum and when One Way is selected it must show the ordinary price!

     

    Please assist! 

    Jotform Thread 1045929 Screenshot
  • Nik_C
    Replied on January 25, 2017 at 10:42 AM

    The problem is in how you did your Round trip calculation. So whenever that option is selected a price is calculated and inserted in Total field. So even if you just click round trip button several times in a row it will add the total price every time.

    Also, I don't see the calculation or condition that refers to one-way selection.

    So that's why nothing happens when it is selected. 

    My advice is the following:

    1. You created conditions that calculate the price of the trip based on locations and that is ok.

    2. Those values are going to Total field, which is hidden on the form, and that is fine as well.

    3. Include one more field in the form call it Total2 or something that will calculate the total price plus the one-way or round trip price.

    So when your users select the locations, total price will go to Total field (the hidden one) and then when they select the one-way/roundtrip, based on that selection Total price will be multiplied with price for one-way and price for roundtrip and then that price will be in Total2 field(which is the total price actually). For one-way price, I assume it will be the same actually so you can simply multiply with number one.

    Hope this helps.

    Please let us know your thoughts.

    Thank you!

  • dotransferme
    Replied on January 25, 2017 at 11:35 AM

    Thanks a lot I will try now to do it!)

     

    I have another question:

     

    based on number of passengers (number 1,2,3,4 or 5,6,7,8,9) we want field to add different amounts. for example if in field Number of Passengers is inputed digit from 6 to 15 we want to add 30$ to total price! If from 16 to 30 we want to add $50

     

    is it possible and how can we create it?

  • Nik_C
    Replied on January 25, 2017 at 11:43 AM

    You're welcome.

    That should be doable wit conditions, but you will have to use number field instead of text field for number of passengers. And that's because then you can use the range condition:

    Why calculation in the form is not working properly? Image 1 Screenshot 20

    And then you can add 30$ to the total price. Now, if you experience similar issue like the initial one then you can put one more field to hold the middle total value that later you can use to add 30$ or 50$ to it. And then that value to show in the end total field.

    Hope I was able to make it understandable. :)

    Let us know how it worked for you.

    Thank you!

  • dotransferme
    Replied on January 25, 2017 at 11:50 AM

    Thanks Nik_C for your assistance this second case lookes more easy.

    But I am unable to create One Way or Round Trip case! (( Maybe you can assist me in this also?

  • Nik_C
    Replied on January 25, 2017 at 12:24 PM

    I'm glad I was able to help.

    Sure, here is how I achieved what you need:

    I added some new text fields:

    Why calculation in the form is not working properly? Image 1 Screenshot 50

    1. So, Total Price From Location is what you actually created with conditions, it is showing the price based on selection of locations.

    2. Then Total Price From Location one way is the same price but I put it there so we can have it separately. As you can see in condition:

    Why calculation in the form is not working properly? Image 2 Screenshot 61

    3. Total price from location roundtrip is total price one way multiplied with 2:

    Why calculation in the form is not working properly? Image 3 Screenshot 72

    4. And finally Total price in USD is the total price field there I created this calculation:

    Why calculation in the form is not working properly? Image 4 Screenshot 83

    It is sum of Total price one way + Total price round trip + VIP.

    Here is my clone of your form so you can have a closer look: https://www.jotformpro.com/form/70244485196966

    As you can see there, I'm revealing all fields, it's easier for tests. But you should hide Total price one, Total price round trip and Total price from the location.

    If you have further questions please let us know.

    Thank you!