Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Command? Post Reply Post New Topic
Author Message
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Topic: Command?
     Posted: 24 Nov 2009 at 3:05pm

Hi, I want to pull data from two tables, and I want to filter the data from one of those sources, but not the other. 

From table one (which contains inventory balances only), I simply want to extract Prod#, and ProdQty. 

From table two (which contains inventory transactions only), I want Prod#, and ProdQty, for any product with Work Order haveing status code of "A" for active.

So far, my trouble has stemmed from the fact that while the first table is balance data, and has only one balance per product, the second table is transaction data, and may have many transaction quantities per product, so when I put the two extracts in columns of one report, the balance data duplicates for every instance of a transaction of the same product number.

So I wind up with:

                 QtyBal           QtyTrans
ProdA            100                     80
ProdB              50                     20
ProdC            150                   100
Total             300                    200
 
 
I actually wind up with:
                 QtyBal           QtyTrans
ProdA            100                     30
ProdA            100                     50
ProdB              50                       5
ProdB              50                       5
ProdB              50                     10
ProdC            150                     40
ProdC            150                     30
ProdC            150                       5
ProdC            150                     25
Total              950                   200
 
 
I want to bring in the transaction data in such a way that it is already summarized, rather than per transaction, but the only way that has been suggested for me to do this is with a Stored Procedure, which I am not able to produce.
 
I have tried to simply suppress duplicates in the Balance collumn, but when I try to sum the data, it still picks up the ones that are suppressed.  I then tried a running total to add them correctly, which does seem to work, but then when I get to the part about filtering only for a status of "A" on the transaction side (which would indicate they are still on an open workorder), I wind up also filtering the OnHand Balances too, which I don't want to.  It is as if it has a link to the same status code, which it should not.  I am wondering if there is a command I could set up that would allow me to get some of this done therein.
 
Any suggestions?
 
Thanks,

Paul


Edited by pgiering - 24 Nov 2009 at 3:11pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Nov 2009 at 6:07pm
You can make version 1 from the data in version2.
Group on Product (group1).
Use a Running Total for QTY Balance
Name=QBalanceG1
Field to summarize=QtyBal 
Type = SUM
Evaluate= ON change of ProductField
Reset=Group1
Place this on GF1
For QtyTrans Sum this on Group1 and place on GF1...SUM(QtyTrans,ProductField)
Place th ProductName on GF1
 
Suprress GH1 and Details section.
 
For report totals...
Use a Running Total for QTY Balance
Name=QBalanceRF
Field to summarize=QtyBal 
Type = SUM
Evaluate= ON change of ProductField
Reset=Never
Place this on Report Footer
For QtyTrans Sum this on RF and place on ReportFooter...SUM(QtyTrans)
IP IP Logged
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Posted: 25 Nov 2009 at 4:02pm
Thanks DBlank,
 
I'm afraid I can't get that method to work, because (and my bad for not mentioning this before) the transactions are an incomplete data set, only certain transactions will be available - not enough to piece together balance information.
 
One other thing I've considered, but I don't know if CR will allow it, is making reference to the table in the query.  Because I can use the running total to sum the data, the only remaining problem is to get one set filtered without filtering the other.  It would be great if I could just say "where the table name is INORDERS, Status must be A", and not have it apply the Status condition where the table name is something else, like BALANCE.
 
Wishfull thinking?


Edited by pgiering - 25 Nov 2009 at 4:03pm
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