Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help getting grouping correct... Post Reply Post New Topic
Author Message
JayMcC28
Newbie
Newbie


Joined: 27 Jul 2011
Online Status: Offline
Posts: 1
Quote JayMcC28 Replybullet Topic: Help getting grouping correct...
     Posted: 27 Jul 2011 at 5:40am
Hi,
 
I've been asked to use Crystal Reports XI to get a particular report from an Oracle DB.  I'm close but I think I'm messing up the grouping.
 
The database has 3 tables in question: a "department" table, an "inventory" table and an "orders" table.
 
Each item has a "department" as well as cost and price.  The "orders" table contains order "documents" that contain items.
 
What I need to do is scan every "order", group the items together by department, add their cost and price and have my report show the total cost and price based by department.
 
So, I thought that what I should do is group by department and put the totals in the department footer.  However, when I do that here's what I get: if a particular "order" has multiple items from the same group the "cost" and "price" get multiplied by the amount of items!
 
I'm pretty green with Crystal Reports.  I took a two day class about 3 years ago.  I can move around OK in there and create some basic reports.  I guess you could say I know enough to be dangerous.  I wouldn't think this would be that difficult but I'm struggling and have a deadline.  Does anyone have any ideas?
 
Thanks in advance,
 
JayMcC28
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 27 Jul 2011 at 7:33am
However, when I do that here's what I get: if a particular "order" has multiple items from the same group the "cost" and "price" get multiplied by the amount of items!


Which makes sense.
You can deal with this by creating a running total on change of group, then putting that in the GF. That would act as your subtotal for each group.

The running total will then be evaluated only on distinct orders

One way to do it is to sort the orders somehow so that the same order appears together, and then having the running total evaluating only when {order} <> previous({order}). Since you have identified that multiple items belong to a single order, there should be a particular field that distinguishes each order from one another (ie: order ID)

Though it is a simplistic solution that hopes you run into nothing complicated

Edited by Keikoku - 27 Jul 2011 at 7:34am
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