• Resolved Francis

    (@emolotel)


    Hello in a calculated field, is it possible to have value 3 if the criteria do not satisfy value 1 and value 2?

    Example:

    (Function () {
    var first=fieldname1, second=fieldname2, third=3;

    if (AND (first> third)) return 1;
    if (AND (first <second)) return 2;

    }) ()

    In case it does not satisfy neither 1 nor 2 must have value 3

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

    (@codepeople)

    Hello @emolotel

    The AND operation has no sense in the equation because you are not comparing multiple conditions. Second, javascript is a case sensitive language, so the correct would be “function” and not “Function”. The equation can be implemented simply as follows:

    
    (function(){
    if(3<fieldname1) return 1;
    if(fieldname1<fieldname2) return 2;
    return 3;
    })()
    

    Or nesting multiple “IF” operations (please, do not confuse the “IF” operation of the plugin with the “if” conditional statement of javascript):

    
    IF(3<fieldname1, 1, IF(fieldname1<fieldname2, 2, 3))
    

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Value different from the function’ is closed to new replies.