• Resolved rphrus

    (@rphrus)


    Hi,

    I would like help on this.

    Field1 enter a number.

    Field2 add 30 to field1 and if the calculated value is greater than 50 then subtract the calculated value from 50 and display the result, otherwise display the calculated value if it’s 50 or less.

    Thank you,

    Tom

    • This topic was modified 12 months ago by rphrus.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @rphrus,

    Thank you very much for using our plugin.

    Your equation can be implemented as follows:

    IF(50<fieldname1+30, 20-fieldname1, fieldname1+30)

    Note you said subtract the calculated value from 50. So, the second parameters is 20-fieldname1 because:

    50 – (fieldname1+30) = 50 – fieldname1 – 30 = 20 – fieldname1

    If you want to subtract 50 from the calculated value, the equation would be:

    IF(50<fieldname1+30, fieldname1-20, fieldname1+30)

    In this case, the second parameter is: (fieldname1+30)-50 = fieldname1-20

    Best regards.

    Thread Starter rphrus

    (@rphrus)

    Hi,

    How can I prevent the calculation from displaying the result when I have not entered a number on fieldname1 yet?

    Thank you

    • This reply was modified 12 months ago by rphrus.
    Plugin Author codepeople

    (@codepeople)

    Hello @rphrus

    Assuming you have the mathematical operation fieldname1+fieldname2 and want to evaluate the mathematical operation when the user has filled in both fields. By default, the plugin preprocesses the fields’ values to use them in mathematical operations. When the fields’ values are empty, the equation result will be zero.

    So, you can edit the equation as follows:

    IF(AND(fieldname1|r != '', fieldname2 != ''), fieldname1+fieldname2, '')

    Note I checked the fields’ values with the |r modifier. I’m telling the plugin:

    If the raw values (without preprocessing) of fields fieldname1 and fieldname2 are different from the empty text, evaluate the mathematical operation or return empty text otherwise.

    Best regards.

    Thread Starter rphrus

    (@rphrus)

    Thank you for taking the time to answer my question. My fieldname1 is an input number and fieldname2 is a calculated value field. So, how would this work?

    Plugin Author codepeople

    (@codepeople)

    Hello @rphrus,

    The process is just the same as described previously. You should check the raw fields’ values and evaluate the mathematical operations if the condition is satisfied.

    Best regards.

    Thread Starter rphrus

    (@rphrus)

    Thank you!

    • This reply was modified 12 months ago by rphrus.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘If then’ is closed to new replies.