Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If then statement error Post Reply Post New Topic
Author Message
cvps
Newbie
Newbie


Joined: 27 Jun 2012
Online Status: Offline
Posts: 1
Quote cvps Replybullet Topic: If then statement error
    Posted: 28 Jun 2012 at 3:30am
I am trying to get the following statement to work:
 
If {tblTransmissionMaster.CutDollars} = 0 then
0
Else
{tblTransmissionMaster.CutDollars} / {tblTransmissionMaster.CutAcres}
I get the division by zero error and I am not sure why.
 
Also I have the following field in my database I want to query on {tblTransmissionMaster.CategoryCode}, I want to get the average cost of cut acres for category TM. How do a write the syntax to show the average for category TM only. Below is what I tried but I know it is wrong:
 
{tblTransmissionMaster.CategoryCode}   = tm
and
If {tblTransmissionMaster.CutDollars} = 0 then
0
Else
{tblTransmissionMaster.CutDollars} / {tblTransmissionMaster.CutAcres}
Any help would be appreaciated!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Jun 2012 at 4:02am
If {tblTransmissionMaster.CutAcres} = 0 then
0
Else
{tblTransmissionMaster.CutDollars} / {tblTransmissionMaster.CutAcres}
 
for the average use a running total on your formula above
name=TM_average
type=average
evaluate= use a formula
{tblTransmissionMaster.CategoryCode}   = "tm"
reset=never
place in report footer
 
 


Edited by DBlank - 28 Jun 2012 at 4:02am
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.