Solved

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

Posted on 2003-12-02
6
235 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

15 Experts available now in Live!

Get 1:1 Help Now