A Working Calculation No Longer Works

  • Profile Image
    adatshalom
    Asked on January 26, 2017 at 05: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.

  • Profile Image
    Kevin_G
    Answered on January 26, 2017 at 07: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: 

    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

     

     

  • Profile Image
    adatshalom
    Answered on January 26, 2017 at 07: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.

  • Profile Image
    Kevin_G
    Answered on January 26, 2017 at 09: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:

    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:

     

    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.