• Resolved avcobb123

    (@avcobb123)


    If I want to include the calculation in a conditional result, can I do this?

    Example something like this:

    if(fieldname20=="No", "The result is" + (fieldname20/fieldname18) + "percent")

    This doesn’t work obviously but wondering if this is possible?

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @avcobb123

    Javascript is a case-sensitive language. Please, do not confuse the if conditional statement of Javascript with the IF operation in the plugin. Furthermore, the IF operation requires three parameters, the condition, the result if the condition is true, and the result if false.

    By using the if conditional statement, the equation can be implemented as follows:

    (function(){
    if(fieldname20=="No") return "The result is " + (fieldname20/fieldname18) + " percent";
    })()

    The same equation by using the IF operation:

    IF(fieldname20=="No", "The result is " + (fieldname20/fieldname18) + " percent", "")

    Note that these equations have no sense if you check the fields’ values. If the value of the fieldname20 field is the text “No” you cannot use it in a mathematical operation (fieldname20/fieldname18)

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘How To Include Field Name Calculation In Conditional Text’ is closed to new replies.