If calculation is less than 0, default to 0

  • Premier11
    Asked on April 2, 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

    Jotform Thread 1432313 Screenshot
  • Adrian
    Replied on April 2, 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.

    If calculation is less than 0, default to 0 Image 10

    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.

    If calculation is less than 0, default to 0 Image 21

    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.

  • Adrian
    Replied on April 2, 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.

    If calculation is less than 0, default to 0 Image 10

    2.

    If calculation is less than 0, default to 0 Image 21

    3.

    If calculation is less than 0, default to 0 Image 32

    I believe it is working as expected now.

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