Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter oligou

    (@oligou)

    My apologies… plenty of topics resolving that

    @admin, please delete my topics

    sorry, tx

    Thread Starter oligou

    (@oligou)

    I still have a question, how to put several if ?

    E.G. a fieldnameY mention 1-2-3 or 4

    If 1 : fieldnameX *80%
    If 2 : FieldnameX *85%
    If 3 : FieldnameX * 90%
    If 4 : FieldnameX * 100 %

    Any idea ?

    THank you !

    Plugin Author codepeople

    (@codepeople)

    Hi,

    The Calculated Field allows to insert complex equations using a javascript code as below:

    (function(){
    if(first condition) return first value;
    if(second condition) return second value;

    if(condition X) return value X;
    })()

    Thread Starter oligou

    (@oligou)

    thank you

    can you just put the first condition as example ?
    I don’t know this code

    Thanks a lot ??

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Please, I’ll try to explain the code with an example:

    Suppose your form contains the field “fieldname1” and you want add 10 to fieldname1 if its value is less than 10, if fieldname1 is less than 100 adds 100, and finally add 1000 to fieldname1 in other cases.

    The equation that correspond to the previous situation is:

    (function(){
    if(fieldname1 < 10){
    return fieldname1+10;
    }else if(fieldname1 < 100){
    return fieldname1+100;
    }else{
    return fieldname1+1000;
    }
    })()

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘sum if ..’ is closed to new replies.