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

    (@codepeople)

    Hello @bulbuljessore

    Thank you very much for using our plugin.

    I’m sorry, I don’t understand your question about the equations because the screenshot provided is about dependency rules.

    Could you please be more specific?

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Ok so if you check the calculator link there is a balloon payment. And I do not want to make it mandatory.

    So for example If I do not put any value on that balloon payment it will calculate the monthly and total payment or if I put any value on that balloon payment this will also calculate the value base on that percentage in the balloon payment section.

    but currently is not calculating anything if I leave the balloon payment option zero.

    I hope that makes seance. Looking forward to hearing from you.

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    Your “Monthly Payment” equation is:

    prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2)

    You are using fieldname14 as the divisor. In mathematics, the division by zero generates an error. I don’t know the result you want to display when the fieldname14 is empty or zero (mathematically, both situations are considered as zero). You should use conditional statements in the equation to separate both cases:

    (function(){
    if(fieldname14)
    {
    return prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2); 
    }
    else return 0;
    })()

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Thanks, I appreciate it but a little bit confused that where you want me to use these conditional statements.

    I mean if you tell me which section I have to put in that will be more helpful for me to fix the problem.

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    The code I sent you previously corresponds to the equation in the “Monthly Payment” field. You should select the field in the forms builder, and enter the equation through its “Set equation” attribute.

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Thanks for your help but that did not change anything. I have already updated the code as you said. You can check the result that I send before the link.

    All I need is if someone leaves the balloon payment as zero it will calculate the monthly and total payment or if someone add any value to the balloon payment it will calculate the monthly and total payment based on all field including the balloon payment.

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    The equation is being evaluated, but in this case, the result is zero.

    To be clear, in mathematics you cannot divide by zero. So, your original equation is valid only for cases where fieldname14 is different from zero.

    prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2)

    Please, describe the equation you want to evaluate when fieldname14 is zero or empty.

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Ok so when the fieldname14 is zero or empty it will calculate from the value-added into fieldname6 & fieldname7

    And when fieldname14 is not zero or empty then it will calculate using fieldname6, fieldname7 & fieldname14

    I hope that makes sense

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    So, if you want to implement the same equation but without the fieldname14 field. It would be similar to:

    (function(){
    if(fieldname14)
    {
    return prec((fieldname2*fieldname7/fieldname14/1200*pow(1+fieldname7/fieldname14/1200,fieldname8)-fieldname6*fieldname7/fieldname14/1200)/(pow(1+fieldname7/fieldname14/1200,fieldname8)-1),2);
    }
    else
    {
    return prec((fieldname2*fieldname7/1200*pow(1+fieldname7/1200,fieldname8)-fieldname6*fieldname7/1200)/(pow(1+fieldname7/1200,fieldname8)-1),2);
    }
    })()

    Please, note I’m not implementing your equation. I’m teaching you to use the if conditional statements.

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Hi there

    Thanks for the code it’s working when fieldname14 is zero but if I put something on fieldname14 it’s not calculating.

    So I am not sure if I can explain it to you or not but on the car calculation some people want to know how much it will be monthly and total payment with balloon payment and some people do not want to know how much it will be monthly and total payment without a balloon payment.

    So it has to work both ways. Please let me know if this is possible with this plugin or not.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    I’m not checking your mathematics, but the equation is being evaluated. Please, watch the video by visiting the following link:

    https://resources.developers4web.com/cff/tmp/2022/08/04/video-form_o.mp4

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Hello again

    Sorry about that I notice the result on an incognito window and I appreciate that you help me to fix it.

    Best regards.

    Thread Starter Bulbul Ahmed

    (@bulbuljessore)

    Hello again

    I noticed that on balloon payment if I put 1% is not changing any value on monthly and total payment would please help me fix the issue.

    Please note that if I put 2 on balloon payment it changing the value.

    Looking forward…

    Plugin Author codepeople

    (@codepeople)

    Hello @bulbuljessore

    Yes, that’s correct. In mathematics A/1 = A

    So, if you enter the number 1 the result does not vary.

    Please, note you have selected the “Number” option for the “Number format” attribute in the fieldname14. For the plugin, it is a basic number. If you want the plugin to treat the value as a percentage, you should select the “Percent” option.

    If you configure the number format as percent, and you enter the number 1 as the field’s value, the plugin will use it in the equations as 0.01

    Best regards.

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

The topic ‘Zero is not working’ is closed to new replies.