• Resolved PB

    (@ohtusabes)


    Hi @codepeople,

    I am trying to do the following, but I can′t:

    *If two CRITERIOS MAYORES are met, or if 1 CRITERIOS MAYORES and 3 CRITERIOS MENORES are met, or if none CRITERIOS MAYORES are met and 5 CRITERIOS MENORES are met, the following text should be displayed in the calculated field “Endocarditis infecciosa confimada”;

    *If 1 CRITERIOS MAYORES and 1 CRITERIOS MENORES is met, or 3 CRITERIOS MENORES are met, the following text should be displayed in the calculated field: “Endocarditis infecciosa probable”.

    *If none of the above, the text “Endocarditis infecciosa rechazada” should be displayed in the calculated field.

    Could you help me with this?

    Thanks in advance.

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    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.

    Thread Starter PB

    (@ohtusabes)

    Hi @codepeople,

    The code works great as usual.

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.