• Resolved Francis

    (@emolotel)


    (function(){
    var first = fieldname41;

    if(AND(>0 first <= 0.3)) return 1;

    if(AND(>0.31 first <= 0.6)) return 2;

    if(AND(>0.61 first <= 0.9)) return 3;

    if(AND(>0.91 first <= 1.2)) return 4;

    if(AND(>1.21 first <= 1.5)) return 5;

    if(AND(>1.51 first <= 1.8)) return 6;

    })()

    What is the correct formula?

    • This topic was modified 7 months ago by Francis.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @emolotel

    Thank you very much for using our plugin, the correct would be:

    (function () {
        var first = fieldname41;
    
        if (AND( 0 < first, first <= 0.3)) return 1;
        if (AND( 0.3 < first, first <= 0.6)) return 2;
        if (AND( 0.6 < first, first <= 0.9)) return 3;
        if (AND( 0.9 < first, first <= 1.2)) return 4;
        if (AND( 1.2 < first, first <= 1.5)) return 5;
        if (AND( 1.5 < first, first <= 1.8)) return 6;
    
    })()
    

    However, as you’re using return instructions, you don’t need to compare with the range, only its right edge, as follows:

    
    (function () {
        var first = fieldname41;
    
        if (first <= 0.3) return 1;
        if (first <= 0.6) return 2;
        if (first <= 0.9) return 3;
        if (first <= 1.2) return 4;
        if (first <= 1.5) return 5;
        if (first <= 1.8) return 6;
    
    })()
    
    

    Best regards.

    Thread Starter Francis

    (@emolotel)

    thank you very much, very quick response

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Return a value after an understood value’ is closed to new replies.