Solved

Make a Crosstab display all rows, even if there is a zero total for that row

Posted on 2003-12-02
6
238 Views
Last Modified: 2012-06-27
I cannot find any answers anywhere to this question. I am trying to make a crosstab that will show all rows even if there is no data to display.

My problem is that I need to regually generate a report and export its data to an Excel spreadsheet. If there is no data for a particular row, CR wont display this row at all. So when I export to Excel, the data shifts up or down depending on what records were omited.

An example of what I am trying to do is:

               JAN     FEB     MAR    TOTAL
Age Group
17 and under   6       0       10     16
18-24          0       0       0      0
25-34          1       7       2      10
TOTAL          7       7       12     26

If it doesn't look right, copy and paste it into Notepad. Thanks.
0
Comment
Question by:coultone
6 Comments
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 9864111
One or more of these techniquest may be useful for you.  In general, these tend to indicate that you use a formula somewhere in the row to force the row's appearance.

http://support.crystaldecisions.com/library/kbase/articles/c2009392.asp
http://support.crystaldecisions.com/library/kbase/articles/c2011156.asp

Another option would be to add a very small value (0.000001) to your January values, for example, and let the formatting and rounding features in CR take care of suppressing the fractional part.  This would give you a non-zero value which should be displayed.  This may cause problems with Excel export, however.
0
 

Author Comment

by:coultone
ID: 9864182
It is hard to explain. My problem consits of a table containing the field I want the crosstab to show, and a look-up table containing all the fields that that field can contain.

My look-up table contains values such as CD, GF, HG, RF, RS and UM. These are codes that refer to an organisation category. The table that contains the data, may not neccesarily contain an organisation category, but I need the row to appear anyway with the row label and a zero or even "NA"in its place.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 9865459
In general you cannot report on data that doesn't exist.  You need a source table which contains a list of all possible row labels and then link this table to your current table.  If you are using a pc database this will give you the result you want; if its SQL server or some other SQL database then you will need to change the link to a left outer join to pull in all the list values.

Pete
0
 
LVL 3

Assisted Solution

by:kathmacmahon
kathmacmahon earned 250 total points
ID: 9874720
Can you base your report off a stored procedure or query?

What you'll need to do is generate those empty rows as part of your query, something like this:

SELECT ID, NULL AS AGE FROM LOOKUP_TABLE
UNION
SELECT ID, AGE AS AGE FROM DATA_TABLE INNER JOIN LOOKUP_TABLE ON DATA_TABLE.ID=LOOKUP_TABLE.ID
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

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. …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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