Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Error calculating formula Post Reply Post New Topic
Author Message
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Topic: Error calculating formula
    Posted: 12 Nov 2009 at 11:06am
Hello all,
I have another issue today where I'm trying to add up some values.
if IsNull({pNVAnnualReportMedicalSection;1.BoxA_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxA_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxB_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxB_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxC_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxC_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxD_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxD_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxE_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxE_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxF_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxF_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxG_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxG_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxH_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxH_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxI_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxI_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxJ_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxJ_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxK_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxK_amt}+
if IsNull({pNVAnnualReportMedicalSection;1.BoxL_amt}) then 0 else {pNVAnnualReportMedicalSection;1.BoxL_amt}
 
The problem is that BoxC value is Null, so from there it's stopping adding the next vales.
so, for ex if baxA.vales  is 10 and boxB.value is 5 and BoxC.value is null, and BoxD.value is 15 the total value is displaying as 15. It stops.
 
Can some one suggest what I might be doing wrong here?
Thanks a bunch in advance!
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 12 Nov 2009 at 1:17pm
Your formula will always stop whenever it finds a null in the box amount .  When the box is null, it returns 0 and then does not go on to the else part of your formula.
 
You might try a formula like this:
 
Global NumberVar sumfield;
sumfield := 0;
if (not(IsNull({pNVAnnualReportMedicalSection;1.BoxA_amt})) ) sumfield := sumfield + {pNVAnnualReportMedicalSection;1.BoxA_amt};
 
You would need an if statement for each box.  The syntax isn't exact but I hope this helps.
 
Good luck
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.