Positive result in form calculation

  • thetechman
    Asked on January 16, 2018 at 7:56 AM

    Hello,

    how can I obtain only positive result in form calculation? I mean, if the result is less than 0, than the result is 0 (8-9=0).

    Thanks

  • Ardian_L
    Replied on January 16, 2018 at 9:14 AM

    You can perform a calculation using Form Calculation Widget. How to use that please follow the instructions on the link below:

    https://www.jotform.com/help/259-How-to-Perform-Form-Calculation-Using-a-Widget

    Then you can use some mathematical functions explained on this url:

    https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference

    In your case the abs() function should do the work. If you need further assistance please provide your form url so we can help you. Thank you!

  • thetechman
    Replied on January 16, 2018 at 9:39 AM

    Hi Ardian_L,

    with abs() I obtain 8-9=1 but I need 8-9=0.

    Form URL https://form.jotformeu.com/73613159595364

    Thanks

  • Ardian_L
    Replied on January 16, 2018 at 9:57 AM

    You can add a hidden Number field to your form and make the default value to 0. And then create a conditional logic if 84.Ore lavorate is less than 0 then copy Number field value to Ore lavorate. Please check the video below for more information.

    1516114634Number Screenshot 10

    If you need assistance please let me know.

  • thetechman
    Replied on January 16, 2018 at 10:23 AM

    I followed your instructions but something does not work as it should: I get 0 even if the difference is > 0.

  • liyam
    Replied on January 16, 2018 at 11:48 AM

    Hello,

    I noticed that your form uses the autofill (continue forms later) option. Can you clear out your browser's cookies and try again to see if the condition works or if it's because of the previous information that appeared? I also recommend to disable the option first while making tests before re-enabling it again.

    We will look forward to your update.

    Thanks.