Crystal Reports – Display Group Header even if there are no rows in Details

crystal-reportscrystal-reports-2008

Well, generally people want to get the contrary, hide a group header when there are no details but in my specific case, I need to be able to show the header even if the details rows are empty. I'm using the built-in crystal reports from Visual Studio 2008.

I've got a subreport on my main report which has group containing data on the group header and the group details. I'd like to be able to show the Header even in case the details are empty but right now, only non-empty details are printing.

What can I do to make it work?

Best Answer

Some more information about your data sources may help. Without that, I'll assume your data source is a single table with a Grouping field and a primary key.

Crystal thinks in terms of records, and without a record (even if it's just a placeholder), Crystal has no way of knowing a group exists. So the trick is to make a Helper/Index table and left join onto it.

Example: You want to group all your data by month, but you have no data for March. In your datasource (or possibly some other datasource. Crystal is versatile enough), add a Helper table that has 1 column with all 12 months listed. After you import this into your report, you can outer-join your real data table onto it. This gives you all of your actual data with a placeholder record for March.

What other questions do you have?