Support » Plugin: Calculated Fields Form » Possible limit on calculations?

  • Resolved dwaynne

    (@dwaynne)


    Is there a limit on the amount of calculations on a page? I have several calculations on the URL above, and some calculated fields show no result or yield an incorrect result. For example, a Property value of 1,000,000 should result in values of 4,500 for my first result field (Stamp Duty Residential Transfer Fee) but no value shows; a Property Value of 5,000,000 should result in a Stamp Duty Residential First Time Home Owner Fee of 218,750 versus the 150,000 being displayed. Example equation for that last calculation (Stamp Duty Residential First Time Home Owner Fee):

    (function () {
    if (fieldname2 <= 2000000) return 0;
    if (fieldname2 > 2000000 || fieldname2 <= 2250000) return (0.05*(fieldname2 – 2000000));
    if (fieldname2 > 2250000) return (0.075*(fieldname2 – 2250000)+12500);
    })();

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

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

    (@codepeople)

    Hello @dwaynne

    No, there are no restrictions on the number of calculated fields. However, your equation is incorrect.

    The piece of code below is never reached:

    if (fieldname2 > 2250000) return (0.075*(fieldname2 - 2250000)+12500);

    Because the following piece of code covers this case too:

    if (fieldname2 > 2000000 || fieldname2 <= 2250000) return (0.05*(fieldname2 - 2000000));

    The correct equation would be:

    (function () {
        if (fieldname2 <= 2000000) return 0;
        if (fieldname2 <= 2250000) return 0.05 * (fieldname2 - 2000000);
        return 0.075 * (fieldname2 - 2250000) + 12500;
    })();

    Best regards.

    Thread Starter dwaynne

    (@dwaynne)

    Thank you very much for the quick reply, @codepeople. Based on your example, I now understand the structure of the equations and modified them all to suit. They’re working perfectly now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Possible limit on calculations?’ is closed to new replies.