• Resolved Alwin

    (@wp-opti)


    I am using a Calculated field with this Equation:
    PREC(MAX(3.9,fieldname7*0.60+2.70),2)

    I would like to add something like this:
    if(fieldname2 > 100) return fieldname35

    or (even better):
    if(fieldname2 > 100) then display a warning text

    In other words: if the value of fieldname 2 is above 100 I would like this calculated field to display (field35 which then shows) a warning text.

    Is that possible,
    Alwin

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

    (@codepeople)

    Hello @wp-opti,

    In this case you can edit the equation as follows:

    
    (function(){
    var result = MAX(3.9,fieldname7*0.60+2.70);
    if(100 < result) return PREC(result,2);
    return 'Warning message here';
    })()
    

    or if you prefer an alert:

    
    (function(){
    var result = MAX(3.9,fieldname7*0.60+2.70);
    if(100 < result) return PREC(result,2);
    alert('Warning message here');
    return '';
    })()
    

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    Thank you very much for your help! However, this is not going to work for me. I think I did not explain very good what I want. I will try again:

    I am using a Calculated field with this Equation:
    PREC(MAX(3.9,fieldname7*0.60+2.70),2)
    In my Form this Calculated field is “fieldname13”.

    Then I am using antoher field, called “fieldname2” which is a Number field.

    Now when the value in fieldname2 is above 100, then I would like to display a warning in the fieldname13.

    In other words: when the value in fieldname2 is above 100 then fieldname13 should display a warning.

    Is that possible?

    Plugin Author codepeople

    (@codepeople)

    Hello @wp-opti,

    In this case the equation would be simpler:

    
    IF(100<=fieldname2, PREC(MAX(3.9,fieldname7*0.60+2.70),2), 'Warning message here')
    

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    That works; great!

    Now I like to add 1 more thing:

    I now have this rule: IF(100<=fieldname2

    I also like to add a second one: IF(200<=fieldname6

    How can I add this one to the equation?

    Plugin Author codepeople

    (@codepeople)

    Hello @wp-opti,

    I’m sorry, but your description is ambiguos, do you want return the result if both conditions are true? If it is the case, the equation would be:

    
    IF(AND(100<=fieldname2,200<=fieldname6), PREC(MAX(3.9,fieldname7*0.60+2.70),2), 'Warning message here')
    

    If you need additional help implementing your project’s equations I can offer you a custom coding service from my private website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    I want to return the warning if (100<=fieldname2 OR (200<=fieldname6

    So not AND but OR

    Hope you understandf now 😉

    Alwin

    Plugin Author codepeople

    (@codepeople)

    Hello @wp-opti,

    Simply replace the AND by OR in the previous equation:

    
    IF(OR(100<=fieldname2,200<=fieldname6), PREC(MAX(3.9,fieldname7*0.60+2.70),2), 'Warning message here')
    

    I’m sorry, but the support service does not cover the implementation of users’ projects (forms or formulas). If you need additional support to implement your project’s equations, you should request a custom coding service through my private website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    I understand. I will also buy the pro version of the plugin now.

    Thank you so far with this topic!

    Regards,
    Alwin

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘complex “Calculated Fields Form”’ is closed to new replies.