Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ilden

    (@ilden)

    I have entered this into the ‘If value is’ section and it didn’t work

    value<12 ==12

    Plugin Author codepeople

    (@codepeople)

    Hi,

    The operation is really simple, if the current equation is for example:

    fieldname1*fieldname2

    You simply should edit it as follows:

    MAX(fieldname1*fieldname2,12)

    and that’s all.

    Best regards.

    Thread Starter ilden

    (@ilden)

    So this is my code here, where would i put the MAX part? sorry for all the questions haha, appreciate the help!

    (function(){
    var field = fieldname6;
    if(AND(fieldname2 ==1, fieldname3 ==1)) {return fieldname6 *0.006;}
    if(AND(fieldname2 ==1, fieldname3 ==2)) {return fieldname6*0.008;}
    if(AND(fieldname2 ==1, fieldname3 ==3)) {return fieldname6*0.01;}

    if(AND(fieldname2 ==2, fieldname3 ==1)){return fieldname6*0.008;}
    if(AND(fieldname2 ==2, fieldname3 ==2)){return fieldname6*0.01;}
    if(AND(fieldname2 ==2, fieldname3 ==3)){return fieldname6*0.012;}

    if(AND(fieldname2 ==3, fieldname3 ==1)){return fieldname6*0.0145;}
    if(AND(fieldname2 ==3, fieldname3 ==2)){return fieldname6*0.0165;}
    if(AND(fieldname2 ==3, fieldname3 ==3)){return fieldname6*0.0185;}
    })()

    Plugin Author codepeople

    (@codepeople)

    Hi,

    You can use the following solution:

    (function(){
    var f6 = fieldname6,
        f2 = fieldname2,
        f3 = fieldname3,
        n  = 1;
    
    if(AND(f2 ==1, f3 ==1)) {n = 0.006;}
    if(AND(f2 ==1, f3 ==2)) {n = 0.008;}
    if(AND(f2 ==1, f3 ==3)) {n = 0.01;}
    
    if(AND(f2 ==2, f3 ==1)){n = 0.008;}
    if(AND(f2 ==2, f3 ==2)){n = 0.01;}
    if(AND(f2 ==2, f3 ==3)){n = 0.012;}
    
    if(AND(f2 ==3, f3 ==1)){n = 0.0145;}
    if(AND(f2 ==3, f3 ==2)){n = 0.0165;}
    if(AND(f2 ==3, f3 ==3)){n = 0.0185;}
    
    return MAX(f6*n, 12);
    })()

    In reality there are other solutions more elegant, for example, using “switch” instructions, or defining the values of “n” into a matrix.

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Setting a minimum price’ is closed to new replies.