A Working Calculation No Longer Works

  • adatshalom
    Asked on January 26, 2017 at 5:38 PM

    In this form, the "Subtotal Children" is not functioning ... it worked when used in the past, but now doesn't. It is set up just like the "Subtotal Adult" but that one has no problem.

  • Kevin Support Team Lead
    Replied on January 26, 2017 at 7:14 PM

    Upon reviewing the web console while checking your form I can see there are some missing values which are showing as "NaN", this happens when a field included in the calculation has not value that can be used to calculate a total: 

    A Working Calculation No Longer Works Image 1 Screenshot 20

    I can see you're not using calculation values in your fields and you're using text in the option, also do note  that when an option is not selected it may return 0 as value and this may set the calculation to be 0 as well by your multiplication (Value * 110) which would be (0*110) = 0 (because all of the fields multiplied by 0 will result as 0).

    What I would suggest you is to assign calculation values to your options and check your calculations to make sure you won't get 0 as result.

    This guide will help with assigning calculation values: How-to-Assign-Calculation-Value

     

     

  • adatshalom
    Replied on January 26, 2017 at 7:54 PM

    Thank you. But the correct answer (which I picked up form your response) is that even though I only had numeric values ... I had selected the option you provide to show text in the empty option box ... and THAT text was interfering THis was not the case a couple years ago when we used this from last (i had made no changes since then). Anyway, I am ok.

  • Kevin Support Team Lead
    Replied on January 26, 2017 at 9:41 PM

    Yes, this may be due to an update made to the form calculation widget to prevent problems in the calculations. 

    Based on how you've set up the fields involved in the calculation "Subtotal Children" I can see the text you've set as pre-selected is causing the issue.

    I have simplified your form and removed all the other fields that are not involved in this calculation, for example, on this form https://form.jotform.com/70258213015950 I have the fields without calculation values, there you can see that some drop downs are pre-defined with the text "MustSelect" and since this is not a number the calculation cannot be done until all the drop downs have selected one numeric option.

     

    Example:

    A Working Calculation No Longer Works Image 1 Screenshot 30

    Since some fields are conditionally hidden then they will never get filled all at the same time. 

    On this second form https://www.jotformpro.com/form/70257231084955 I have added calculation values and it works fine, setting 0 for the pre-defined text and the needed value for the other options, if you select at least one option it will work no matter that other drop downs have selected the text.

    Example:

      A Working Calculation No Longer Works Image 2 Screenshot 41

    So I would suggest you to apply the same change to your form, set calculation values to your drop downs so you get properly the calculation. 

    Hope this helps.