How to add greater than/less than logic with two different outcomes?

  • assist_program
    Asked on June 2, 2016 at 1:04 PM

    Hi,

    I want to be able to calculate two different possible outcomes within the same field.

    For example:

    If the total of a field "A" is less than 30,000, I would like field "B" to calculate 80% of field "A". But if field "A" is greater than 30,000, I would like field "B" to calculate 70% of field "A".

    I have tried creating two separate if/then functions for the same field, but it always calculates using the 80%. I would like to find a way to input two calculations into the same function:

    IF "A" < 30,000, THEN "B" = "A"*0.8; and IF "A" > 30,000, THEN "B" = "A"*0.7

    I have tried looking at older support issues, but the conditions page design is different and I cannot figure out how to do it on the current version. I have also used both the Calculation Wizard and the normal number field & . Or is there another way to do this?

    Thank you!

  • Kevin Support Team Lead
    Replied on June 2, 2016 at 2:41 PM

    I have checked your form and I noticed your condition is currently like this: 

    How to add greater than/less than logic with two different outcomes? Image 1 Screenshot 50

    Although I have checked your form and it is working as expected, I mean it is calculating the correct total: 

    How to add greater than/less than logic with two different outcomes? Image 2 Screenshot 61

    I would suggest you to instead of calculating the total again, use the total you have already calculated in the Calculation Widget you already have in your form, so the calculation should be like this: 

    How to add greater than/less than logic with two different outcomes? Image 3 Screenshot 72

    Here is my cloned form if you want to take a look and see how it works: 

    https://form.jotform.com/61535139441958

    Also, you should include the value 30000 in a condition, for example, if value is less than 30000 or equal to 30000 otherwise if the value is that amount it will not do anything: 

    How to add greater than/less than logic with two different outcomes? Image 4 Screenshot 83

    If you think your form is still not calculating properly, please do let us know and provide where the issue is exactly, we will be glad to help you. 

  • lvbmarketing
    Replied on June 2, 2016 at 2:56 PM

    I'm trying to do a greater than/less than condition as well....

    How did you get the option for "Greater Than" or "Less Than"? I don't even have those options to choose from when using the "Update/Calculate Field" under Conditions. I have 'is equal to', 'is not equal to', 'contains', 'does not contain', 'starts with', 'does not start with', 'ends with', 'does not end with', 'is empty', and 'is filled'. What am I doing wrong that I do not have those options?

    https://www.jotform.com//?formID=61514183123951

    I need the Total to be $300 or greater in order to submit. Is there a way for me to use a condition for this?

  • Welvin Support Team Lead
    Replied on June 2, 2016 at 4:28 PM

    Looks like you've already found the way to have the "greater than" and "less than" rules. You can also do this when using a Number field. This won't appear when using a textbox. I think you are set already. Do let us know if you need any further assistance with your form. I love the green color by the way, the form is so neat :)

  • assist_program
    Replied on June 2, 2016 at 4:55 PM

     

    Thank you very much! It has taken a few days to create this form :)

    It's still not working quite right--I have shortened the calculation, and have the two separate conditions for the one output field. Yours works perfectly, but mine won't for some reason.

    Here are the conditions I have used, specifically for the "Amount Provided by Grant" field:

    How to add greater than/less than logic with two different outcomes? Image 1 Screenshot 50

    How to add greater than/less than logic with two different outcomes? Image 2 Screenshot 61

    How to add greater than/less than logic with two different outcomes? Image 3 Screenshot 72

     

    But the resulting form still calculates it incorrectly for some reason. The number in "Amount Provided by Grant" should be "47,600" and "Amount to be Fundraised" should be "20,400".

    How to add greater than/less than logic with two different outcomes? Image 4 Screenshot 83

    Is there something else I may be doing incorrectly?

  • Mike
    Replied on June 2, 2016 at 8:52 PM

    It looks like that there is something wrong with your form setup. Unfortunately, I have not found the source of the issue yet. I will look further into this and get back to you later.

  • Mike
    Replied on June 3, 2016 at 7:47 AM

    I have removed a dollar sign from your 'Student Labor Total:' calculation field.

    How to add greater than/less than logic with two different outcomes? Image 1 Screenshot 40

    And added it to the conditions.

    How to add greater than/less than logic with two different outcomes? Image 2 Screenshot 51

    How to add greater than/less than logic with two different outcomes? Image 3 Screenshot 62

    The form seems to be fine now.

  • assist_program
    Replied on June 3, 2016 at 8:49 AM

    It's working perfectly now. Thank you, Mike!