Calculating only the values of visible form fields

  • nickma
    Asked on October 26, 2016 at 8:53 AM

    Hi, 

     

    Firstly let me say what great support you have, I have been getting my head around using your forms and calculation and the support has always been really good and very good and making it clear how to use your forms and widgets.

    However I'm still stuck, still working on the calculation within this form: 
    https://form.jotformeu.com/62976611426360

    It's doing the calculation fine, but it's adding all the drop down fields together. How do I amend the calculation so it works out just the drop down field the form is currently being selected?

     

    Thanks, Nick

  • Boris
    Replied on October 26, 2016 at 11:34 AM

    Hi Nick, if I understand correctly how your form should calculate the value, then this should be an easy fix. We have two problems with the current set up.

    1. When a field is hidden (by selecting another option inside the Fencing Options field), its value is still being counted in the calculation. To make sure that a hidden field loses its value and doesn't get calculated, we should open up your forms Preferences:

    Calculating only the values of visible form fields Image 1 Screenshot 40

    Once there, switch to the Advanced tab, click Show More, and change Clear Hidden Field Values to Clear On Being Hidden:

    Calculating only the values of visible form fields Image 2 Screenshot 51

    2. The other problem with the calculation is that it will create a number with a larger number of zeroes, due to the way the calculation is set up. Essentially, your calculation is this:

    Close Board Close Board Larch Lap Larch Lap Burberry Panel, times Number of Fence Panels.

    If we select any value from the first Close Board field, say a value of 110, it will actually add a zero for each empty drop down field after it in the calculation, so your calculation would currently calculate as:

    110 0 0 0 0 * Number of Fence Panels, essentially giving you 10.000 times greater result then desired.

    To overcome this, I would recommend wrapping the first part of your calculation inside parenthesis, and add a plus sign in between each field, like so:

    Calculating only the values of visible form fields Image 3 Screenshot 62

    Please do try it out and let us know how it goes. Cheers!