Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Keeping track of the count of parts... Post Reply Post New Topic
Author Message
cmross
Newbie
Newbie


Joined: 05 Nov 2014
Online Status: Offline
Posts: 10
Quote cmross Replybullet Topic: Keeping track of the count of parts...
     Posted: 23 Sep 2015 at 10:38am
Afternoon all.. Hopefully I can thoroughly confuse you as much as I've confused myself..

The company I work for builds machines. We have each machine broken down into logical assembly steps. Each of those assembly steps has a number of parts that are needed to build it. We keep track of these parts in our ERP system with inventory counts. We keep parts in inventory until all the parts for a assembly step are here (mainly so they don't get lost.. it happens a lot). I'm trying to make a report that shows all of the assembly steps for all of the machines that are being built, and which ones have all the parts here so we can pull them. That report in itself is easy enough for me to do, but to add another layer of insanity to it, I wanted to only pull the parts I had ENOUGH inventory for. So if I have 3 assembly steps that use quantity 1 of a part, but I only have 2 available in inventory, I only want to pull the first two assembly steps.

So far what I have done is make a report that is grouped by part. In the details section, I have all of the open assembly steps listed and the quantity of the part needed for each. It is sorted by the due date of the final machine so I know which parts are needed for which assembly steps first. Then I took how many we have available in inventory and subtracted out how many are needed for each line. Kind of looks something below (only condensed):

Part 12345 (has quantity 3 available in inventory)
             Qty Need    Inventory Qty Left
Step AAAAA      1               2
Step BBBBB      2               0
Step CCCCC      1              -1

Part 23456 (has quantity 7 available in inventory)
             Qty Need    Inventory Qty Left
Step AAAAA      2               5
Step CCCCC      3               2

Part 34567 (has quantity 4 available in inventory)
             Qty Need    Inventory Qty Left
Step AAAAA      2               2
Step BBBBB      2               0

Where in the first line 'Inventory Qty Left' = available in inventory - Qty Need, then each line below is the previous 'Inventory Qty Left' - Qty Need. So according to this, I should be able to pull parts for Step AAAAA and Step BBBBB but not Step CCCCC because I don't have enough of Part 12345 leftover in inventory.

So then I made another report where it's grouped by the assembly step and the parts and quantities needed are in the details. Looks something like this:

Step AAAAA
              Qty Need
Part 12345     1
Part 23456     2
Part 34567     2

Step BBBBB
              Qty Need
Part 12345     2
Part 34567     2

Step CCCCC
              Qty Need
Part 12345     1
Part 23456     3

What I would like to be able to do is add a column to the right of 'Qty Need' and insert the value calculated for the leftover inventory in the previous report so it would look like this:

Step AAAAA
              Qty Need    Inventory Qty Left
Part 12345     1               2
Part 23456     2               5
Part 34567     2               2

Step BBBBB
              Qty Need    Inventory Qty Left
Part 12345     2               0
Part 34567     2               0

Step CCCCC
              Qty Need    Inventory Qty Left
Part 12345     1              -1
Part 23456     3               2

I've inserted the first report as a subreport into the second and linked it by the part number, but that's as far as I've been able to get. If I link the sub report to the specific step, it gets rid of the detail lines of the other steps in the first report and doesn't make the 'Inventory Qty Left' column accurate. I don't know how (of if it's even possible) to take the value from the first report and put it into the second. Or if I'm even thinking about how to do this correctly. Any support would be greatly appreciated!
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 24 Sep 2015 at 10:01am
I don't think this is something you're going to be able to get Crystal to do for you by just connecting tables together. How are your SQL skills? I think you're going to have to write a command that will do all of this - main and sub - in a single query. A command is just a SQL Select statement, although there are a few 'tricks' to it, and you can do some fairly complex things with SQL. If you want to learn more about using commands, see my blog post here: http://scn.sap.com/community/crystal-reports/blog/2015/04/01/best-practices-when-using-commands-with-crystal-reports

Another option would be to write a stored procedure in the database that returns a data set that Crystal can then use for the data for the report. The stored proc would do all of the calculations and return just the data to be displayed, making the report itself very simple.

-Dell
IP IP Logged
cmross
Newbie
Newbie


Joined: 05 Nov 2014
Online Status: Offline
Posts: 10
Quote cmross Replybullet Posted: 25 Sep 2015 at 12:21am
Unfortunately, my SQL skills are non-existent at the moment. My company is sending me for an advanced Crystal class where I should hopefully learn some. Maybe I'll be able to do something with the report after that.
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