views:

501

answers:

2

The situation is the following:

In a database I have a table that stores the number of occurrencies an error occurred. Say

ErrorId  Timestamp  N
Err1     t1         2
Err2     t2         7

I query this data, and must use the cross-table of crystal report to show the data. Three (3) error codes must be shown: Err1, Err2 and Err3, in this order.

I defined the cross-tab and selected "in predefined order" in the general tab for the group options (just below the definition of the rows). I inserted 3 Groups (Err1, Err2 and Err3).

In the resulting report it is no problem for Err1 and Err2. But Err3 is not shown.

Question

Is there a way to show the empty row for Err3 even though there is no data for it?


Version used: Crystal report XI.

+2  A: 

If Err3 is not included in the data then it will not be displayed in the cross-tab.

I would recommend altering your query so Err3 is always included, even if it doesn't have any data. You could outer join your Err table (assuming that you have one) to your Occurrence table.

Craig
The "outer join" is not necessary and often not very efficient when dealing with big tables. Adding dummy rows with "union all" (and completing the colunns with dummy values) is often faster.
mr_georg
+1  A: 

You can do this by doing a LEFT JOIN link from your Error table to the Occurence table, but you must make sure that the settings Convert Database NULL Values to Default and Convert Other NULL values to Default are turned off. Otherwise, the count of Err3 will erroneously show up as 1 as the query will convert the uncountable NULL to a countable 0 value.

CodeByMoonlight