Support » Plugin: Calculated Fields Form » % calculations

  • Resolved nickp87


    Hey, great plugin.

    Just doing some testing to see i this will work for what i need, i have setup most of my form, and the end result is fine set up as below

    Result of 1×2
    Cost equals result x10

    Now i need one last calculated field to remove a % of the cost if an option is selected, is this possible and if so how

    Thanks for any help

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



    The process is simple. Suppose your form includes a radio group field, called fieldname1, with two choices, a first choice with value 1, and a second one with value 2. Now suppose your form includes a fieldname2, and you want remove a 20% of fielname2 if the value of fieldname1 is 1, or a 30% if the value of fieldname1 is 2. The equation would be:

    (fieldname1 == 1)?fieldname2*0.8:fieldname2*0.7

    Best regards.

    Hmm, sorry i am clearly not cut out for this as that sounds alien to me 🙂

    Basically i need the equation to remove 30% (or any other %) from the cost field, would your solution above do that?

    Form is here and i need the percentage to come off of the cost estimate field

    Thanks for your help

    Plugin Author codepeople



    The URL you sent me display a 404 Error, page not found.

    If you want remove the 30% of a number, the solution is: number*0.7, to remove the 20% is the number*0.8 ….

    The other part of the equation is the ternary operator of JavaScript:

    (condition) ? value1 : value2

    That is interpreted like:

    if condition is true then value1, else value2

    You only should join both concepts in your equation.

    Best regards.

    First of all, thank you very much for you help so far 🙂

    Using your calculation above, for the 20% off, using the form (fixed now)

    If you input 5 and 2 in the number boxes you get a cost estimate of 420, using a field with the value fieldname10*0.8 should give me 336, but instead gives me 376, also get the wrong cacl for 30%, changed it to remove 50% using *0.5 and that worked fine

    Plugin Author codepeople



    If you enter the values 5 and 2, the square meters would be 10, and the cost estimated, that was defined like 47*sq meters, would be 470 and not 420. Finally, the last field, with the equation Estimated Cost * 0.8, would be 470*0.8 = 376

    So your form is working fine, the only way the estimated cost be 420 is modifying the equation associated to the sq meters field.

    Best regards.

    Off to purchase the pro plugin, just for listening to my ramblings, can’t believe i thought it was 420 when it shows 470 in the box, must have been to early in the morning for me.

    Thanks again, top notch support 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘% calculations’ is closed to new replies.