views:

26

answers:

2

I have a crystal report with a subgrouping on a field. The output is shown each group-details vertically stacked as follows:

  Group Header Value 1 
  Detail 1a 
  Detail 1b 
  ....

  Group Header Value 2 
  Detail 2a 
  Detail 2b 
  .....

 and so on.

 What I need to see is the detail values in table columns as follows:

 Group Header Value 1     Group Header Value 2     Group Header Value 3
 Detail 1a                Detail 2a                Detail 3a 
 Detail 1b                Detail 2b                Detail 3b
 Detail 1c                                         Detail 3c
                                                   Detail 3d

I've tried formatting the Detail Section with multiple columns along with formatting the group with multiple column, but it's just a mess. I know I will only have at most 4 distinct Group values.

Any suggestions please?

Thanks.

+1  A: 

Crystal is not very good at displaying items vertically like that, but here are a couple of options I can think of:

  1. Build up 4 arrays where each corresponds to one of the groups and contains strings that are what you'd like to output for each record (one array element for "Detail 1a", one for "Detail 2b", etc.). You can do this by creating a single formula in your details section that checks the individual records for the group condition and add the values to the appropriate array.

    In the report footer, create 4 formulas that output the entire contents of one of the arrays delimited by a newline character. If your arrays contain strings, you can simply use the Join() function to output the whole thing with a delimiter. Make sure those formula fields are set to "Can Grow" and place them side-by-side.

    The downside to this is Crystal arrays are limited to 1000 elements, so if you'll have over 1000 records per group, this is a bad idea.

  2. You could make 4 individual subreports for each group and place them side-by-side. I've never tried something like this before, so there might be some quirks that I'm not considering. Generally, though, you should be able to put whatever you want in the subreports and as long as it doesn't grow too large width-wise (you may needle to manually specify a very small page size in the subreports to make sure of this), it should look relatively the same as how you place them in your main report
Ryan
The 4 individual subreports side-by-side is probably the best way to go. To ensure consistent formatting, I recommend making the subreport first as a standalone report, then importing it 4 times. Then just change each record selection formula to the appropriate group and you're good to go.
PowerUser
Thanks for the suggestions, I will give them a try.
shamrockva
A: 

If I understand the question correctly, you want to implement your report in a format similar to a Pivot table (as can be found in Excel).

The Crystal equivalent of this is call a Cross-Tab - you can add one to your report by selecting Insert>Cross-Tab... . This will bring up the Cross-Tab Expert, which will enable you to drag and drop the fields you want to see down and across the page into the appropriate places.

Mark Bannister