Title: Zero is not working
Last modified: August 4, 2022

---

# Zero is not working

 *  Resolved [Bulbul Ahmed](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/)
 * I am having an issue with the calculated field. On the balloon payment, I want
   that if anyone adds a number that will calculate, or if they do not add the number
   or leave it as zero, it will also calculate and give the result.
 * But not able to achieve the result [https://prnt.sc/U1k8Cd0T-rRr](https://prnt.sc/U1k8Cd0T-rRr)
 * Here is the link of that form [https://www.olgarsauto.co.za/?cff-form=8](https://www.olgarsauto.co.za/?cff-form=8)
 * Let me please because I have to fix the problem.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fzero-is-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15887588)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15887610)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15887651)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15887671)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15887682)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888509)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888531)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888577)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888603)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888626)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888686)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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](https://resources.developers4web.com/cff/tmp/2022/08/04/video-form_o.mp4)
 * Best regards.
 *  Thread Starter [Bulbul Ahmed](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15888706)
 * 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](https://wordpress.org/support/users/bulbuljessore/)
 * (@bulbuljessore)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15889042)
 * 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](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15889070)
 * Hello [@bulbuljessore](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/zero-is-not-working/#post-15889070)
 * Status: resolved