views:

2167

answers:

4

Please help!

I need to produce a Crystal Report with multiple data columns, but need to show row headers as well.

e.g.

(Fieldname)        (DataColumn1)        (DataColumn2)       (DataColumn3)
Animalname         Elephant             Dog                 Mouse
Animalsize         Large                Medium              Small

I have successfully got the data columns to display using the 'Format with multiple columns' option in the details section, but is there any way of displaying the headers (Animalname / Animalsize)?

(I am using Crystal Reports 2008 inside Visual Studio 2008)

+1  A: 

If the table columns are name and size, you vertically arrange the details fields like...

name  {name_field}
size  {size_field}

but i think the problem with that is when you "format with multiple columns" it would turn into this...

name  {name_field}  name  {name_field}  name  {name_field}
size  {size_field}  size  {size_field}  size  {size_field}
name  {name_field}  name  {name_field}  name  {name_field}
size  {size_field}  size  {size_field}  size  {size_field}
name  {name_field}  name  {name_field}  name  {name_field}
size  {size_field}  size  {size_field}  size  {size_field}

is that the problem? How to only display the "row header" in the first column? Because I'm not sure if that's possible. And even if you could do it, is this what you really want?

name  {name_field}  {name_field}  {name_field}
size  {size_field}  {size_field}  {size_field}
name  {name_field}  {name_field}  {name_field}
size  {size_field}  {size_field}  {size_field}
name  {name_field}  {name_field}  {name_field}
size  {size_field}  {size_field}  {size_field}

Wouldn't it be easier to just go the standard way of...

name          size          name          size          name          size
{name_field}  {size_field}  {name_field}  {size_field}  {name_field}  {size_field}
{name_field}  {size_field}  {name_field}  {size_field}  {name_field}  {size_field}
{name_field}  {size_field}  {name_field}  {size_field}  {name_field}  {size_field}
{name_field}  {size_field}  {name_field}  {size_field}  {name_field}  {size_field}
{name_field}  {size_field}  {name_field}  {size_field}  {name_field}  {size_field}

Am I missing something?

EDIT

Create a formula for each field like so...

if remainder(recordnumber, 3) = 1 then
"Field Name    " + {some_field}
else
{some_field}

might want to put the conditional into a function, in case you ever want to display more than 3 columns.

dotjoe
You got it - I want the headers in the first column (or a section of the report to the left of the first column), but as you say, it doesn't appear to be possible. Unfortunately I can't format the data in the standard way as you describe, because the design of the report must match the specification document I have been given. The data I gave was just an example, the real thing has about 25 fields which need to be shown in 3 columns and they would not be repeated in the way you show.I guess I'll go for the subreport option unless anyone else has any ideas? Thanks for the reply though.
JamesW
Maybe insert the field names into the data so that the 1, 4, 7, etc row contains the rowheaders and the other rows contain the data. It's a hack, but it could probably be done with a temp table and stored procedure. Otherwise, you might be able to come up with a suppress formula for those row header fields using sharedvar counter and suppress the field every (counter modulo 3 != 1)
dotjoe
Thanks dotjoe - those are some great suggestions I hadn't though of! I'll give them a try, but I'll mark your original post as the answer.
JamesW
I thought of an even better one...see the edit.
dotjoe
Nice one. I'll try that too!
JamesW
A: 

Could you please tell me... how did you display records into columns???

For years I didn't think it was possible, but I finally found a note in the SAP website:Right-click on the Details section, to open the Section Expert dialog box. On the Sections list, click the details section. On the Common tab, select Format with multiple columns check box. A new tab called Layout appears. On the Layout tab, specify the formatting for the columns:Enter the width of the column in the Width box
JamesW
A: 

thank you dear, thank you very much for help... best regards...

A: 

hey...were u able to display the data horizontally under one header using sub report..i am unable to do that...please let me know how if you were able to.

Garry