I need to convert my Excel report to Crystal Reports XI.
I have a query that fetches orders from tables tblOrder and current stock from tblStock.
Desired result:
GroupA:
DelDate (planned delivery date), sorted ascending
GroupB:
CustCode (customer code), sorted ascending (the sorting will be the priority order for deliveries)
Details:
ArtNr (article number), sorted asc
OrdQty (order quantity)
and the challange - a field "NewStock" which is equal to the current stock for this record's article number, minus the sum of all previous order quantities for this article number, including the quantity for the current record. This field will show a negative if ordered quantity up until now is bigger than the actual stock.
So I want this done for each record, no summaries for groups.
This is easy if GroupA is ArtNr. But it isn't...
So any suggestions are welcome. I can change the query or use whatever necessary in Crystal Reports, but I can't figure out how to solve this.
In Excel, I solved it by sorting the table by OrdDate, then CustCode. Then this formula gives me what I want:
=[@Stock]-SUMIF(INDIRECT("$B$2:B" & ROW([@ArtNr]));[@ArtNr];INDIRECT("$C$2:C" & ROW([@ArtNr])))
where column B is ArtNr and column C is OrdQty.
Now, this goes into a Pivot Table where I do the grouping.
Here's the Excel file:
Stock_Order_Report.xlsx
Please help - I'm going nuts!
And be nice, this is the first time I use Crystal Reports, I'm more used to Excel and Access...
EDIT: CHANGED SUBJECT
Edited by pbengtss - 22 May 2016 at 10:38am