Conditionals and text string in the calculated field

[ad_1]

Hello @ohtusabes

I’ll try to describe the process with a hypothetical example.

Assuming the fields for “CRITERIOS MAYORES” are fieldname1 and fieldname2, and the fields for “CRITERIOS MENORES” are fieldname3, fieldname4, fieldname5, fieldname6, and fieldname7.

You can insert a calculated field in the form and enter the following equation:


(function(){
let count1 = SUM(fieldname1, fieldname2, function(x){ if ( x == 'Sí') return 1; return 0;});

let count2 = SUM(fieldname3, fieldname4, fieldname5, fieldname6, fieldname7, function(x){ if ( x == 'Sí') return 1; return 0;});

if( OR(count1 == 2, AND(count1 == 1, count2 == 3), count2 == 5) ) return 'Endocarditis infecciosa confimada';

if( OR(AND(count1 == 1, count2 == 1), count2 == 3)) return 'Endocarditis infecciosa probable';

return 'Endocarditis infecciosa rechazada';

})()

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