Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Error Post Reply Post New Topic
Author Message
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Topic: Formula Error
     Posted: 15 Jul 2008 at 10:24am
I know this should be a simple formula, but because I'm not a formula expert, I need a little help with this.
 
Here is the formula I'm using.
{IM2_InventoryItemWhseDetl.YtdQtySold} + {IM2_InventoryItemWhseDetl.QtyIssuedYtd} / {IM2_InventoryItemWhseDetl.AveOnHandQtyAt}
 
This is the error:
Division by Zero.
 
 
 
Thanks,
 
 
Luis
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 15 Jul 2008 at 10:52am
Try this

if {IM2_InventoryItemWhseDetl.AveOnHandQtyAt}=0 then 0 else

({IM2_InventoryItemWhseDetl.YtdQtySold} + {IM2_InventoryItemWhseDetl.QtyIssuedYtd} / {IM2_InventoryItemWhseDetl.AveOnHandQtyAt})

Hope this helps,

Sarah
IP IP Logged
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Posted: 15 Jul 2008 at 11:49am
It Works Big%20smile... However, The numbers are off.
Example of one of the records:
{IM2_InventoryItemWhseDetl.YtdQtySold}=243.00
{IM2_InventoryItemWhseDetl.QtyIssuedYtd}=480.00
{IM2_InventoryItemWhseDetl.AveOnHandQtyAt})=73.50
 
if I do the 243.00+480.00 / 73.50 in a calculater I get 9.8367 and rounded to the nearest = 9.84  But in the report I get 483.31.
 
How's this?  What I really want in the report is the 9.84
 
Thanks,
 
 
Luis
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 15 Jul 2008 at 11:53am
It has to do with missing parantheses in the original equation.

To get this result it should look like

(A+B)/C

I think I've listed it correctly below.

if {IM2_InventoryItemWhseDetl.AveOnHandQtyAt}=0 then 0 else

(({IM2_InventoryItemWhseDetl.YtdQtySold} + {IM2_InventoryItemWhseDetl.QtyIssuedYtd}) / {IM2_InventoryItemWhseDetl.AveOnHandQtyAt})

Sarah
IP IP Logged
RiosLA
Newbie
Newbie
Avatar

Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Quote RiosLA Replybullet Posted: 15 Jul 2008 at 4:35pm
This works GREAT! thanks everyone...

Edited by RiosLA - 15 Jul 2008 at 4:35pm
Luis (the Drifter) Rios
IT Administrator
rios_la@hotmail.com
IP IP Logged
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