• Resolved verymary

    (@verymary)


    https://climaterebels.org/en/cruise/
    Password: cruise123

    I have problems to define a conditional statement.
    The case is: If a Cruise Name (fieldname 4) is selected, then it should return fieldname4*fieldname5*0.01*fieldname6;
    if “My cruise is not on the list (Value=0” (fieldname9) is selected, it should return
    fieldname7*fieldname5*0.01*fieldname6;

    Here is my equation:

    (function(){
    if(fieldname9==0)
    return fieldname7*fieldname5*0.01*fieldname6;
    if (fieldname9!==0 && fieldname4>0)
    return fieldname4*fieldname5*0.01*fieldname6;

    })();

    Where is my mistake?

    Thanks for your help!

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

    (@codepeople)

    Hello @verymary

    If a field has not value, or not choice selected (radio buttons, checkbox), its default value is zero (to prevent the mathematical operations throw a parser error).

    So, the solution would be as follows:

    1. Enter as the value of the choice in the fieldname9 a number different of zero, for example: 1
    2. Edit the equation as follows:

    
    (function(){
    if(fieldname9==1) return fieldname7*fieldname5*0.01*fieldname6;
    if (fieldname4>0) return fieldname4*fieldname5*0.01*fieldname6;
    })();
    

    and that’s all.
    Best regards.

    Thread Starter verymary

    (@verymary)

    Thanks a lot! Works now!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘IF-Statement’ is closed to new replies.