Support » Plugin: Calculated Fields Form » Changing the rounding off function

  • Resolved Dean


    the contact form enables one to round off but what if i wanted to set my own rounding off parameter.
    this are the current conditions
    If the value of the passed parameter is greater than or equal to x.5, the returned value is x+1; otherwise the returned value is x.

    what if i wanted for instance, if the value is 2680 it rounds it off to 2700. if its 2630 it rounds it off to 2650.

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



    In this case the equation will be a little more complex that usual. For example, suppose that original equation is fieldname1+fieldname2, if you want to use an uncommon operation for rounding the result, you should transform the previous equation like follow:

    var r = fieldname1+fieldname2;

    if(r == 2680) r = 2700;
    if(r == 2630) r = 2650;

    return r;

    so i should insert all that where? in the equation field? and i want it to do that for every value that is calculated. is it possible?
    thank you for your prompt response.

    Plugin Author codepeople



    The demo in the previous entry, should be entered in the equation field. But pay attention, it is only a demo to demonstrate how to define a equation more complex.

    You may create complex equations in all Calculated Fields.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing the rounding off function’ is closed to new replies.