Support » Plugin: Calculated Fields Form » does not work “function”

  • Resolved anka3000

    (@anka3000)


    Hi,
    Enter a formula into a calculated field. But only the first condition works. For the rest, 0 is displayed. Where is the mistake?

    (function(){
    var perem;
    if(1 <= fieldname9,  fieldname9 <= 20) {
    perem = 1;
    }
    else if (21<= fieldname9,  fieldname9 <= 40) {
    perem = 0,7;
    }
    else if (41<= fieldname9,  fieldname9 <= 50) {
    perem = 0,5;
    }
    else if (51<= fieldname9,  fieldname9 <= 10000) {
    perem = 0,3;
    }
    
    return Math.round(perem*fieldname9*fieldname11);
    })()
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @anka3000

    Thank you very much for using our plugin. Please, include the “and” (&&) operator in the conditional statements. Furthermore, in javascript, the decimal symbol in decimal numbers is the point:

    (function(){
    var perem;
    if(1 <= fieldname9 && fieldname9 <= 20) {
    perem = 1;
    }
    else if (21<= fieldname9 && fieldname9 <= 40) {
    perem = 0.7;
    }
    else if (41<= fieldname9 && fieldname9 <= 50) {
    perem = 0.5;
    }
    else if (51<= fieldname9 && fieldname9 <= 10000) {
    perem = 0.3;
    }
    
    return ROUND(perem*fieldname9*fieldname11);
    })()

    Best regards.

    Thread Starter anka3000

    (@anka3000)

    Thank you! You are the best!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.