Conditional Logic: Calculation values is incorrect if the entered number has decimal point.

  • ericbrandt
    Asked on March 26, 2024 at 8:41 PM

    On this form,


    When I use 500 for the haul rate, 2 for the number of cans and 8 for the hauls per month, select wood and Pallets, the calculations perform as they should.


    When I chance to 500.05 (or any decimal number) the calculations blow up.

  • Joshua_T JotForm Support
    Replied on March 26, 2024 at 11:04 PM

    Hi Eric,

    Thanks for reaching out to Jotform Support. I am sorry you are having trouble with this. To confirm, are you referring to all the data in these fields?

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 20

    If not, can you tell us which fields are not correct, so we can investigate it?

    Once we hear back from you, we can move forward with a solution.

  • ericbrandt
    Replied on March 27, 2024 at 7:21 AM

    Any one of these:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 20

  • Lorevie JotForm Support
    Replied on March 27, 2024 at 8:44 AM

    Hi Eric,

    Thanks for getting back to us and providing a screenshot. I'll need some time to look at this. I'll get back to you as soon as I can.

    In the meantime, let us know if you have any other questions.

  • Lorevie JotForm Support
    Replied on March 27, 2024 at 10:35 AM

    Hi Eric,

    Thanks for patiently waiting. We appreciate it. I'm sorry, I've done some tests but can't find the right solution to calculate the right amount. Can you explain to us the supposed answer to the sample inputs you mentioned so we can check which from the calculation conditions are making the total value wrong? In that way, we can understand better the flow of your calculations.

    Once we hear back from you, we'll be able to move forward with this.

  • ericbrandt
    Replied on March 27, 2024 at 2:20 PM

    The calculations work fine with whole numbers.

    I think it has something to do with the formatting of the Estimated monthly Savings field (masked widget).

    If I use the following numbers:

    Haul Rate: 500

    Cans: 2

    Average hauls:8

    Select: Wood and Pallets

    Results: Estimated Monthly Savings is $1,240


    If I change Haul rate to 500.05 the Estimated Monthly Savings should be $1,240.12 but is showing up as $124,012.



  • ericbrandt
    Replied on March 27, 2024 at 2:34 PM

    If I use 2 for number precision in the input mask then the result for 500.05 is correct, but the result for 500.00 is incorrect.

    Not sure how to solve this.

  • Joshua_T JotForm Support
    Replied on March 27, 2024 at 2:41 PM

    Hi Eric,

    Thanks for getting back to us. I am sorry you are having trouble with this. After reviewing your form, I saw that the problem is with how the Mask Input Widget has been set up, and it has nothing to do with the conditional logic. Let me show you how to fix this:

    1. In Form Builder, click on the Estimated Monthly Savings field, and click on the Wand icon.
    2. Then, enter 2 in the Number Precision section, and enter a dot (.) in the Decimal Separator.
    3. Finally, click on the Update Widget button.

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 30

    Check out this screencast below for the result:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 41

    You can visit the Demo Form, so you can test it out. You can also clone it if you want to get a copy of this form to your account.

    Reach out again if you have any other questions.

  • ericbrandt
    Replied on March 27, 2024 at 2:46 PM

    This doesn't work if the number entered in Haul rate does not have decimal values. Try it for 500 or 500.00 and you will get a number that is divided by 100, Ie.. 2 decimal places are added to the whole number of $1,240. It becomes $12.40

  • Joshua_T JotForm Support
    Replied on March 27, 2024 at 2:51 PM

    Hi Eric,

    Thanks for getting back to us. Please allow me some time to check on this. I will circle back to this thread once I have an update.

    Thanks for your patience and understanding.

  • Joshua_T JotForm Support
    Replied on March 27, 2024 at 3:06 PM

    Hi Eric,

    Thanks for patiently waiting. After checking for a solution, I saw that using a Form Calculation Widget instead of the Masked Input widget works better. So, in the Demo Form, I replaced the conditional logic that is tied to the affected Masked Input Widget with the Form Calculation Widget Check out this screencast below:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 20

    This function has been applied to the previous Demo Form. You can visit it to test it.

    Reach out again if you have any other questions.

  • ericbrandt
    Replied on March 27, 2024 at 3:08 PM

    Great, Let me try that.

  • ericbrandt
    Replied on March 27, 2024 at 3:28 PM

    That worked. Final question. How do I get thousands separator (,) into that field?

  • ericbrandt
    Replied on March 27, 2024 at 4:01 PM

    I figured it out.

  • Gian_D JotForm Support
    Replied on March 27, 2024 at 4:08 PM

    Hi Eric,

    Thanks for getting back to us. I’m sorry you're having difficulties with this. I cloned your form and tested it to see if I could replicate the issue, and I ran into the same issue. When I looked at your form, I saw that the Form Calculation widget wasn't configured correctly. I applied the fix to the cloned version, and everything was working properly. Check out the screencast below:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 60

    As you can see, it's now showing the right format, and amount in the Estimated Monthly Savings field. You can clone my demo form to make things easier, or you can apply it on your own. Let me show you how to do it:

    1. In Form Builder, click on the Wand icon of your Estimated Monthly Savings field, and clear everything inside.
    2. Click on Save.

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 71

    3. Click on Settings in the orange navigation bar at the top of the screen, and in the menu that opens on the left side of the page, click on Conditions.
    4. Click on All Fields, and click on Estimated Monthly Savings.

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 82

    5. Click on the Pencil icon of the first condition.

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 93

    6. Follow the condition settings below:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 104

    7. Repeat the same steps to your second, and third condition.

    That's it. Let us know if you have any other questions.

  • ericbrandt
    Replied on March 28, 2024 at 9:52 AM

    Thanks, I got that all working.

    One final issue (I think)

    If i use a haul rate of 312.5, hauls per month of 8, cans 2 and wood & pallet. It breaks the formulas and I get $0 for Estimated monthly sales.


    I picked 312.5 because it gives me exactly 35% as can be seen in the un hidden placeholder %. For some reason it is not being picked up on this formula

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 30

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 41

  • Chris_L JotForm Support
    Replied on March 28, 2024 at 10:45 AM

    Hi Eric,

    Thanks for getting back to us. I can replicate the issue, when I enter a value 310 - 316 in Current cost per Haul field, the Estimated Net Monthly Savings value returns to 0. I’ll need a bit of time to look into this. I’ll get back to you as soon as I can.


  • Chris_L JotForm Support
    Replied on March 29, 2024 at 3:18 AM

    Hi Eric,

    Thanks for patiently waiting. The issue seems related to the condition in the recent screenshot you shared. When I changed the value from .35 to 0.35, that fixed the issue. Here's how to do it:

    1. In Form Builder, in the orange navigation bar at the top of the screen, click on Settings.
    2. Click on Conditions on the left side of the screen.
    3. Hover your mouse over condition number 7 and click on the Pencil icon.
    4. Update the value from .35 to 0.35.
    5. Finally, click on Save.
      Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 30

    Here's a screencast of the expected result:

    Conditional Logic: Calculation values is incorrect if the entered number has decimal point Screenshot 41

    Give it a try and let us know if you need any help.