If calculation is less than 0, default to 0

  • Profile Image
    Premier11
    Asked on April 02, 2018 at 11:09 AM

    I'm still having an issue with my form calculating negative totals. I was told I would need to add an additional box to my form to generate the correct calculation for negative amounts. I want negative calculations to default to zero. I added a box called Return difference and set up a condition rule, If the total is less than 1 show the total as zero. Now when the total is great than zero, the return difference box is still showing zero.

    I need to know:

    1. How can I make sure positive numbers do not default to zero.

    2. Do I really need this extra box to get my calculation. I would prefer customers not see this box

    Thank you

    Nina

  • Profile Image
    Adrian
    Answered on April 02, 2018 at 12:40 PM

    I have created a simple DEMO form for you and I hope you can apply the same logic to your form.
    Form URL: https://form.jotform.com/80914649129969

    This seems to be tricky to get it right, so I think the additional field is required.

    I have 4 number fields in that form. I want to subtract Number 1 and Number 2. So, if Number 1 - Number 2 is greater than 0, then the difference should just be calculated as it is (copied).

    If the difference Number 1 - Number 2 is equal to 0 or less than 0, then the result should default to 0.

    I had to set these conditions.

    15226870543.png

    First, the difference should be calculated only when both fields are filled.
    Second, if the difference is equal to 0 or less than 0 (negative), the result should be 0.
    Third, if the difference is greater than 0 (positive), the result is Number1-Number2.

    Here it is in action.

    15226871921.gif

    I used the All Questions in One Page Layout for demonstration purposes. This should be applicable using the Cards Layout as well.

    Let us know if you need further assistance.

  • Profile Image
    Adrian
    Answered on April 02, 2018 at 12:53 PM

    I have cloned your form and deleted all the conditions related to this.

    Then I added the following conditions.

    1.

    152268791411.png

    2.

    152268794112.png

    3.

    152268796013.png

    I believe it is working as expected now.

    Cloned Form URL: https://form.jotform.com/80915314829966