Solved

Using field summary from another report

Posted on 2009-03-31
9
314 Views
Last Modified: 2013-11-05
Hi Everyone,
I have two databases, one with sales records and one with stock records.

I can create a report that summaries sales records (grouped by a category) and
I can create a report that summarises stock holding (grouped by category)

But I cant seem to create a report that shows both.

The report will only extract inventory records that happend to be in the sales database. Where I would like the sales report to summarise all sales (per category), and summarise all inventory items (per category) regardless of whether there was any sales activity for an individual item.

I dont quite know where to start with this problem
0
Comment
Question by:holdsworthbros
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 35

Expert Comment

by:James0628
ID: 24035806
The basic idea would be to link from the stock table to the sales table, and use a LEFT OUTER join so that a stock record will be included, even if it has no entries in the sales table.

 Like I said, that's the basic idea.  Let me know if you need more help.

 James
0
 

Author Comment

by:holdsworthbros
ID: 24055952
Hi James,
Thanks for your solution. It does work, kinda sorta. Although I still run into trouble. Its slightly more complicated than I indicated. The sales are stored in two tables. One 'sales header table' that stores generic information, like the date of sale, salesperson etc. It links through one field to the 'sales detail table' that stores the inventory items that are sold. (the linking field is the sale invoice number).

If I left outer join the inventory file and the sales detail file then the left outer join works. But if I then add the sales header table (joined by the sales invoice number) and select according to a field in the sales header table, then the left outer join 'fails' and I only get records from each table that are an exact match.

Is it my linking thats stuffed or does Crystal just not like it?
0
 
LVL 35

Expert Comment

by:James0628
ID: 24056182
> ... and select according to a field in the sales header table ...

 What, exactly, does your record selection look like?

 I've read that if you use a LEFT OUTER join in CR, but then try to check a field in the table that you're joining with (as you're doing), then CR changes the join back to an INNER join.  That could very well be what's happening to you.

 However, the few times that I've looked at situations like this, that did not happen to me.  I've been able to LEFT OUTER join to a table, check a field in that table, and I still had the LEFT OUTER join, and got the records I wanted.  So, while the join may be changed in some cases, it doesn't seem to happen all of the time.

 The problem may be in your record selection, which is why I asked what yours looks like.  In particular, if you're testing fields in the sales header or detail table, you have to check for nulls first.  CR does not like seeing a null value when evaluating a formula and will just quit evaluating the formula if it runs into one.  So, for example, if you're looking for a specific order number that was entered in a parameter, but you also want to see every item that was not sold at all (doesn't make much sense, but it will do as an example :-), your record selection would look something like:

IsNull ({sales header table.order number}) or
 {sales header table.order number} = {?order number parameter}


 James
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:holdsworthbros
ID: 24084413
Hi James,
Thanks again.

The joins stay as left outer join. So thats not the problem.

The database tables look like this...
inmaster = inventory table
orderdtl = inventory items that sold under a sales header (effectively this table is a comprehensive list of every line item that has sold on an invoice)
orderhea = Sales header table (contains generic data of the sale and has a sub table (orerdtl) that contains the inventory items that sold in the invoice batch.

inmaster.CODE --LOJ--> orderdtl.PART_CODE    (the partcode is unique to an inventory item)
orderdtl.ORDER_NUMBER---innerjoin--->orderhea.ORDER_NUMBER (a sales invoice number is unique to the sale)

Record selection...
orderhea.STATUS is one of "Z", "C", "X" (Dont include any sales that are flaged as Z, C, X)

I so hope you're not confused!
0
 

Author Comment

by:holdsworthbros
ID: 24084427
Sorry... STATUS is NOT one of "Z", "X",  "C" (Dont include any sales that are flaged as Z, C, X)
0
 
LVL 35

Expert Comment

by:James0628
ID: 24095006
OK, you need to check STATUS to see if it's null first.  Something like:

not IsNull ({orderhea.STATUS}) and
not ({orderhea.STATUS} in [ "Z", "C", "X" ]


 James
0
 
LVL 35

Accepted Solution

by:
James0628 earned 500 total points
ID: 24095018
Oops,  Forgot the closing ).

not IsNull ({orderhea.STATUS}) and
not ({orderhea.STATUS} in [ "Z", "C", "X" ])

 James
0
 

Author Closing Comment

by:holdsworthbros
ID: 31565139
Thank you!!!!!!
0
 
LVL 35

Expert Comment

by:James0628
ID: 24103634
You're welcome.  Glad I could help.

 James
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question