• Resolved Alwin

    (@wp-opti)


    I have a calculated field in my form with this equation:

    CEIL(fieldname2*fieldname6/100);

    Now I want to add a rule like this:

    when the value of (fieldname2*fieldname6/100) is 5 or higher then the equation should stay like it is now and the result should be rounded upwards to the nearest integer (CEIL)

    but when the value is lower then 5, then the result should not be rounded upwards to the nearest integer, but should be rounded upwards in 1/2 values like this:

    value/result = 1,2 rounded upwards to 1.5
    value/result = 1,6 rounded upwards to 2,0

    and so on for all values lower then 5

    How can I do this?

    Thank you.

    Regards,
    Alwin

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

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

    (@codepeople)

    Hello Alwin,

    The equation is really simple, you only should follow the steps in your description:

    
    (function(){
    var value = fieldname2*fieldname6/100;
    if(5 < value) return CEIL(value);
    else return CEIL(value,0.5);
    })()
    

    and that’s all.
    Best regards.

    • This reply was modified 6 years, 2 months ago by codepeople.
    Thread Starter Alwin

    (@wp-opti)

    Thank you, but something is not working now:

    the result of (fieldname2*fieldname6/100) is not displayed anymore in the calculated field where this new equation is active!

    Maybe a little thing missing in the code you gavce me?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’ve fixed the code, please, look the previous entry.

    Best regards.

    Thread Starter Alwin

    (@wp-opti)

    That worked! Thank you very much ??

    Best regards,
    Alwin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘values rounded upwards in 1/2 ?’ is closed to new replies.