Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Technical Questions
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Technical Questions
Topic: Formula Error
Author
Message
RiosLA
Newbie
Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
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 Logged
saoco77
Senior Member
Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
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 Logged
RiosLA
Newbie
Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
Posted: 15 Jul 2008 at 11:49am
It Works
... 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 Logged
saoco77
Senior Member
Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
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 Logged
RiosLA
Newbie
Joined: 03 Jun 2008
Location: United States
Online Status: Offline
Posts: 12
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 Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
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
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
BAEZL
© 2004-2026 Brian Bischof. All Rights Reserved.