Solved

Using field summary from another report

Posted on 2009-03-31
9
316 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
Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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