What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No signup required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

Calculations not working
Asked by SunbridgeInstitute on February 03, 2017 at 02:56 PMLast year one of your team (I think it was Charlie) devised a smart, but complex, method for our institute to calculate discounts based on the following rules:
"pay full price for the first, largest course, then all subsequent (lesser or equal value) courses will be charged at 10% off"
I have used the technique that he demonstrated, plus some extra complications (we have an optional alumni discount that cannot be combined with the other combo discount, and we have a Waldorf Weekend course that gets a bigger discount with combination).
Anyway, I have this thing all set up and it works most of the time, but sometimes it does not, and twice this morning I had huge errors. I want to send you a screen shot of one of them, and see what you think I might be doing wrong.
Thank you so much for looking into this. I've been working on it for so many hours now my eyes are bugging out!
https://www.jotform.com//?formID=70335506612954

JotForm Support
I could not get to reproduce the issue:
Is there any other selection you did besides those 3 you selected? Any other field that may alter the selection.
You can check your revision history to see if you change anything that may have altered the functionality: https://www.jotform.com/help/294Howtoviewformrevisionhistory
Let us know if you need more help.

This is very frustrating. I had the same problem last year. It does not happen every time; it happens inconsistently.
I know this was not due to a recent change, because it happened on my colleague's computer over a week ago, twice in one sitting. I thought it was a fluke, since everything was fine on my own computer. But now that it's happening on my computer as well, I need to address this. In this particular case you don't have to reproduce the problem in order to help me. Please trust the screen shot. I have another screen shot as well, but the system only allowed me to upload one.
To answer your question, the selections that I made in this screen shot were the only selections. But it happens with other selections as well.
If you can at least look at the fields that contribute to the Discounted Total, and make sure I am using the logic properly based on my initial description. I have an inkling that it has something to do with the formula placed in the "Discounted Total" field. When I reviewed all the formulas, this one is glaring because it is a "count" formula, which doesn't make sense to me. However, I can't explain why it WORKS most of the time if it is so wrong! In any case, it seems there must be some conflicting calculations somewhere, since it does not work consistently.
If I'm on to something here, I'd appreciate if you can guide me with the correct formula to use, since this form is so complex that my head is spinning and I just can't figure out this one aspect of it.
By the way, this is the form I am currently working on: https://www.jotform.com//?formID=70335506612954
Thank you very much for your help; your staff has been extremely helpful over the last year or so in making this complex form work for us, and I greatly appreciate your help.

JotForm Support
I have checked your form in question, and it seems the issue you are describing can be recreated by selecting the following option:
Exploring Waldorf High School Education: July 1621 ($795)
If you check, uncheck, check, and uncheck this option quickly enough, you would start getting incorrect calculation values on your form. Similar happens with other Waldorf options, or simply checking and unchecking options.
You are right that it is the Discounted Total field (ID 315) that manifests this behavior. Upon checking the source code of your conditions and calculations, I see that this field somehow has 2 different calculations that both provide their result into the same Discount Total field:
Once such an error occurred, it started breaking this calculation. The way to resolve it is to remove your existing Discount Total calculation that is broken, and set up a fresh new calculation in its place.
If you want the calculation to get its value correctly, you cannot have two different calculations set to output their result, and unfortunately the only way to resolve such an issue is to remove / stop using the broken form field. You should instead set up a new calculation field for calculating Discount Total, and then use this newly created field in any other "cascading" calculations that may depend on it.
I hope this helps.

Boris, you are my new hero today! Thank you for identifying the issue!
If I understand you correctly, you are saying that my form is making 2 different calculations, and the results of both these calculations are competing to display in my "Discounted Total" field. That totally makes sense.
My only question now is, how do I find the other place where the competing calculation is coming from? I know that the small number is coming from the "count" formula that is located in the "Discounted Total." I assume that the conflicting calculation (the CORRECT one) must be located in conditions somehow, but how can I identify it? I just combed carefully through all my calculation fields and logic, and I can't seem to locate it.
Thank you so much for your help!

JotForm Support
Glad to know that my colleague found the issue. I am now able to replicate it in my cloned version.
I am not completely sure if the following has fixed the issue(since the form is complex), but I think that removing the formula setup in the "Discounted Total" calculation wizard, would fix the problem:
Please test my cloned version: https://form.jotform.com/70365726785972
And let us know if that solves the issue.

Thank you for your help. This is not actually working consistently. Now it seems that it is making a calculation of zero that is competing with the other (mysterious, hidden) calculation. See screen shot:
Is there any way to easily convert this calculation field into a plain, noncalculating field? Apparently I have a "cascade of calculations" that rely on this field so I don't really want to delete it, breaking the mysterious links to the other calculations which are actually correct.
Thank you!

JotForm Support
I have checked this on my end and noticed the same as my colleague above, the calculation seems to be working since it shows a value when I selected the options:
I will ask to my colleague Boris for some help in order to locate the field "315" and remove it, I think this has something to do with the current result it shows since the count function itself will not perform any calculation and should show the number of selected items instead as on this sample form: https://form.jotform.com/70366475176968

Thank you for your reply. I do understand how the count function works, and it was indeed confusing to me why the calculation that appeared in that field most often was not a count number. I like Boris's explanation that it is two different formulas/logic that are competing to show in that one field.
BDAVID's suggestion to remove the count formula from that field made a lot of sense based on Boris's explanation, so I tried it, but it's not working (as demonstrated by my previous screen shot).
I believe what is happening is that, because this is a calculating field, and the initial result of the blank calculation is zero, this zero is still competing with the other calculations that are supposed to land in this field.
I'm assuming, if I am right in my analysis here, that converting the field to a regular text field rather than a calculating widget field, would solve my problem. I do not really want to delete the calculation field and create a new replacement text field, because there is such a cascade of calculations through this form, and it feels like a "house of cards" to mepulling out the wrong one might make it collapse!
Please let me know if it is possible to make a simple transformation of the field to a regular text field. If not, then can you please walk me through how I can solve this problem. Thank you very much!

JotForm Support
Thank you for the added information, and I'm afraid that it is unfortunately not possible to change the field type from one kind to another.
Your field 315 on form 70335506612954 is a form calculation field, the one with the label Discounted Total, and it somehow got corrupted with having two calculations on it. This can be seen by looking at your form's source code:
viewsource:https://form.jotformpro.com/form/70335506612954
This type of corruption is very rare, but once it happens probably the safest way to deal with the issue in a way that will prevent other conflicts from occurring is to stop using that form field, and set up another one in its place.
So in your case, we would rename your old calculation that is broken into Discounted Total 2016, in order to easily differentiate the two fields. Then, we would add another form calculation field to your form, and name it Discounted Total:
We would set up your new calculation field to calculate what you wanted from the start. Based on your descriptions, it sounds like you wanted the new Discounted Total field to take the value of LwstDiscTtlfinal field, so simply set that up in your new calculation.
Now, I would say that this is the safest way to deal with the issue, but what seems to work fine in my tests is that we can also simply set up that very same calculation for your original Discounted Total field.
You might ant to try that first, due to simplicity. Simply set your original Discounted Total field to calculate the LwstDiscTtlfinal field, and since that is the very same action that the other calculation for field 315 is doing, they would both perform the same action and the result would be the same  whichever of the two conflicting calculations would display its result.
Please try out any of these recommendations, and let us know how it goes.

Thank you, Boris. This is very clear to me now. I was not understanding that the two conflicting formulas were in the same fieldI thought that the conflicting formula was coming from some conditional logic that I could not find. This makes a ton of sense.
I have done as you suggest, and I am happy to report that the form is working well!
Thank you so much for your help!
