Solved

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

Posted on 2003-12-02
6
234 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now