• Resolved sina1991

    (@sina1991)


    hello, i cant insert more than two function (if) in the Set Equation.
    (function(){

    if(fieldname11<=360) return fieldname22

    ;if(360<fieldname11<=720) return fieldname23

    ;if(720<fieldname11<=1050) return fieldname25

    })();

    this code not work. just two function (if) work but need several if in my code.

    • This topic was modified 5 years, 1 month ago by sina1991.
Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @sina1991

    In javascript if you want check if a value is into an interval, the correct would be:

    
    if(360<fieldname11 && fieldname11<=720) return fieldname23;
    

    As you can see, it is and “AND” operator (&&) and the two comparisons.

    Or using the “AND” operation distributed with the plugin:

    
    if(AND(360<fieldname11, fieldname11<=720)) return fieldname23;
    

    So, your equation can be implemented as follows:

    
    (function(){
    if(fieldname11<=360) return fieldname22;
    if(AND(360<fieldname11, fieldname11<=720)) return fieldname23;
    if(AND(720<fieldname11, fieldname11<=1050)) return fieldname25;
    })()
    

    Actually, in your specific case compare by an interval is unneeded. A simple way to implement the equation would be:

    
    (function(){
    if(fieldname11<=360) return fieldname22;
    if(fieldname11<=720) return fieldname23;
    return fieldname25;
    })()
    

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘limited function in Set Equation’ is closed to new replies.