Support » Plugin: Calculated Fields Form » How to build function for IF with many fieldnames

  • Resolved maxflexpl

    (@maxflexpl)


    Dears,

    i have a problem with calculate value. Without further ado:
    <%fieldname1%>
    Have 4 fields where:
    Text (Value)
    60-67 (60) and dependencies: If selected show: <%fieldname2%>
    68-73 (65) and dependencies: If selected show: <%fieldname3%>
    74-80 (70) and dependencies: If selected show: <%fieldname4%>
    81-86 (75) and dependencies: If selected show: <%fieldname5%>

    <%fieldname2%>
    Have 4 fields where:
    Text (Value)
    69,5-71,5 (A)
    72-74 (A)
    74,5-76,5 (A)
    77-79 (A)
    <%fieldname3%>
    Have 4 fields where:
    Text (Value)
    74,5-76,5 (B)
    77-79 (B)
    79,5-81,5 (B)
    82-84 (B)

    Etc……

    I need calculation where:
    if user choose from <%fieldname1%> value 60-67 (60) it will be calculate <%fieldname1%>+<%fieldname2%>
    if user choose from <%fieldname1%> value 68-73 (65) it will be calculate <%fieldname1%>+<%fieldname3%>
    etc.
    I don’t know how to build a function in Calculated Field
    Please help 😊

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

    (@codepeople)

    Hello @maxflexpl

    You simply should to use conditional operations in the equation associated to the calculated field, similar to:

    
    (function(){
    if(fieldname1 == 60) return fieldname1+fieldname2;
    if(fieldname1 == 65) return fieldname1+fieldname3;
    })()
    

    Of course, you should to include in the equation the other conditions.

    Best regards.

    @codepeople

    Big, big thanks 🙂 its working 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to build function for IF with many fieldnames’ is closed to new replies.