Showing wide cross-tabs in a subreport

Monday 4 May 2009 @ 9:41 am

I recently had a project where we aligned the columns of one cross-tab with the columns of a similar cross-tab in a subreport. Both cross-tabs always had the exact same columns.  This worked fine as long as the cross-tabs fit horizontally on one page.  But when the cross-tabs had too many columns for one page the main report’s cross-tab would spill over onto the ‘horizontal pages’ that Crystal will generate for wide cross-tabs.  The cross-tab in the subreport would not spill over, but would truncate at the edge of the page.

After some experimenting I stumbled onto the simple solution.   I made the subreport object wider – much wider – as wide as the widest cross-tab would be.  If you went into the design mode of the main report you would see this subreport stretched way beyond the right edge of the design area.  To stretch an object this far you either have to zoom way out or you can go into “Object Size and Position” and just the width to the desired number of inches.  Having the subreport object wider than the page allows the cross-tab within the subreport to also be wider than the page.  It can now spill over onto any available horizontal pages in the main report.

However, there is one catch. This only works if there is a horizontal page in the main report.  If there is no cross-tab in the main report, or if the main report cross-tab isn’t wide enough to generate the horizontal pages, then the subreport’s cross-tab won’t generate those pages by itself, even if the object is wide enough.  This method worked well in my situation because there were matching cross-tabs in both main and sub.

One final note.  This won’t work in v8.5 but works fine in all later versions.  If you like to read about techniques like this you should check out my “Expert Techniques” series.

2 Responses to 'Showing wide cross-tabs in a subreport'

  1. gfend - May 20th, 2009 at 11:11 am

    I also discovered this method. The problem I have is all the extra white space used by the cross-tabs for column headings and row grand totals. In my case I do not need them but the cross-tab still uses the real estate even if they are suppressed. It would be nice to stack the cross-tabs without this extra white space in between them, and have the report flow seamlessly.

  2. gfend - May 20th, 2009 at 12:54 pm

    On the theme of cross-tabs, you may know this one but, another slick trick I learned is to overlay one cross-tab on top of another, with the same dimensions to show a different row total. In my case I needed to show an average of the row. The rows are widgets and the columns are locations where the widgets are sold. The cross-tab sums
    each widget for its location, but we want to see the average widgets sold across the row. To accomplish this I created another cross-tab with a formula to calcualte the average, and placed it in the total column summarized as Maximum. I then overlayed the original cross-tab with this cross-tab that has everything suppressed except for the total column. The original cross-tab has the total column suppressed. It shows up exactly where it needs to be. The trick of coarse is that both cross-tabs must have the same number of rows and columns.

Leave a Reply

Recrystallize Pro

Crystal Reports Server