More “IF” in calculate field

[ad_1]

Hello @momo2105,

Your equation has some parsing errors, so I’m not sure what formula you want to implement.

Could you describe the formula? Not your implementation of the formula but its description.

Best regards.

Hi

i have find the solution like this:

(function(){

if(fieldname1 == “ECB” && fieldname2 == “RD”) return 165;

if(fieldname1 == “ECB” && fieldname2 == “RD” && fieldname4 == “D”) return 315;

if(fieldname1 == “EHB” && fieldname2 == “RD” && fieldname4 == “D”) return 750;

if(fieldname1 == “EHB” && fieldname2 == “RD” && fieldname3 > 250) return 300;

if(fieldname1 == “EHB” && fieldname2 == “RD” && fieldname3 < 250) return 250;

})()

all work only one not

this:

if(fieldname1 == “ECB” && fieldname2 == “RD” && fieldname4 == “D”) return 315;

i dont have for now the online version i only test what is possible made with the CFF

Hello @momo2105

A return instruction returns the equation value, ignoring the remaining equation instructions. For this reason, the order of the “if” conditional statements matters. You must enter the “if” from more specific instructions to more general. So, you must swap the first and second conditional statements:


if(fieldname1 == "ECB" && fieldname2 == "RD" && fieldname4 == "D") return 315;

if(fieldname1 == "ECB" && fieldname2 == "RD") return 165;

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer