• Resolved Ricardo Rocha

    (@ricrocvet)


    I’m creating a conditional formula, but something is wrong, as I keep getting a 0 value returned. Formulas work individually, but not together. Guess I’m missing something, but no idea what.

    PREC((function(){
    IF(fieldname4<=92407, fieldname2==1, fieldname3==1); return fieldname4*0;
    IF(fieldname4>92407, fieldname4<=126403, fieldname2==1, fieldname3==1); return (fieldname4*0.02)-1848.14;
    })(), 2);

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @ricrocvet

    Javascript is a case-sensitive language, you are confusing the “IF” operation in our plugin with the “if” conditional statement in javascript. The correct equation would be:

    
    
    PREC((function(){
    if(AND(fieldname4<=92407, fieldname2==1, fieldname3==1)) return fieldname4*0;
    if(AND(fieldname4>92407, fieldname4<=126403, fieldname2==1, fieldname3==1)) return fieldname4*0.02-1848.14;
    })(), 2);
    

    Note there are other combinations of fields: fieldname4, fieldname2, and fieldname3 you are not checking in your equation.

    Best regards.

    • This reply was modified 4 years ago by codepeople.
    Thread Starter Ricardo Rocha

    (@ricrocvet)

    Sorry, still not working. I’m used to write formulas in Excel, this is new to me.

    What do you mean by “Note there are other combinations of fields: fieldname4, fieldname2, and fieldname3 you are not checking in your equation.”?

    Thanks.

    Thread Starter Ricardo Rocha

    (@ricrocvet)

    Sorry, it did work, I didn’t check all your formula!

    Plugin Author codepeople

    (@codepeople)

    Excellent !!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Formula issues’ is closed to new replies.