Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Columnar Report? 1

Status
Not open for further replies.

bowline

Programmer
Aug 7, 2001
23
0
0
US
Has anyone run this scenario?

(Crystal 8.5)

I want to have groups of data treated as an entity and formatted in multiple columns - Across then Down - within my report.

I would like to have a group heading at the top of each column with the data below it:
[tt]
=========================================================
GroupHeader1 GroupHeader2 GroupHeader3 GroupHeader4
Data1 Data2 Data3 Data4
Data2.1 Data3.1 Data4.1
Data3.2
=========================================================
[/tt]
But it is showing up like this:
[tt]
=========================================================
GroupHeader1 Data1 GroupHeader2 Data2
Data2.1 GroupHeader3 Data3 Data3.1
Data3.2 GroupHeader4 Data4 Data4.1
=========================================================
[/tt]
Each section is treated as a separate object. I have tested with keeping each of the sections together (as well as the group itself), but nothing seems to change the results...

This is a subreport that I was hoping to put in the group footer of my parent report. I am at a total loss right now.

Thanks in advance for any help!
bowline
 
I think the display you want is really Down, then across, but formatting with multiple columns so that a new column occurs regardless of number of details would be a little complicated.

I can't tell whether you are talking about multiple instances of one group, or whether you are talking about multiple groups. If this is all one group, then you could insert a crosstab and use your group field as the column, and add an id field that occurs for each record as your row field so that it would force the display of all records under each group. The summary field would be whatever your "data" field is.

If you want to try the multiple column format, format the details section to "format with multiple columns"->layout->set the column width and gap->"Down and then across" and then check "Format groups with multiple columns".

Determine how many records will fit in one column vertically (let's say it's 59) and then create a formula:

if {#cntwingrp} = count({table.grpfield}, {table.grpfield}) then
replicatestring(chr(13),59-count({table.grpfield},{table.grpfield}))

//where {#cntwingrp} is a running total created in the running total expert by choosing {table.grpfield},count,evaluate for each record, reset on change of group

This formula also assumes that each group has no more than 59 records.

Right click on the formula->format field->common->check "Can grow". Put this formula in the detail section. Adjust the number (59) until the columns always are headed by the group field.

-LB
 
LB
That formula sounds interesting. I will definitely try it out. I never really learned the syntax for advanced Crystal formulas so I always work with a bit of a handicap (usually remedied by prepping the data with a stored proc). Your example gives me something good to work with.

FYI -

I will have multiple groups within a parent group. But the parent group also has a details section. So this data set is kind of a secondary details section that needs to be grouped as well - hence the subreport.

It is a report to display large meeting plans. I group by date, then by functions within the meeting. Then each function has planning components such as room setup, food/beverages, etc. This particular portion is going to display a varying number of speakers who will be presenting at a particular function. Each speaker can have anywhere from 1 to 10 additional details about themselves, each stored in different records. The goal is to have the speakers' names show up at the top of the column, with their information displayed below. Since the report is going to be pretty big (30+ pages), I wanted to save as much real-estate as possible and print each speaker across the page before it went down.

I will test out your different solutions and let you know what works out. I searched a lot online and could not find anything worthwhile, so your help is greatly appreciated.

Thanks!
 
Well, I could not get your formula to work - not sure what I was doing wrong...and the cross tab would not work either - it would not wrap around the page and the fields would not grow.

But I came up with a pretty good solution. Thought I would share:

- Create a @ResetAll formula. This one goes into the Group Header (hidden section):
Code:
whileprintingrecords;
global StringVar array arrDetails;
global NumberVar intCount;
redim arrDetails[100];
intCount := 0;
- Create a @Details formula. This one goes into the details section (hidden section):
Code:
whileprintingrecords;
stringVar array arrDetails;
numberVar intCount := intCount + 1;
arrDetails[intCount] := {Table.FieldName};
- Create a @DisplayArray formula. And this one goes into the Group Footer:
Code:
whileprintingrecords;
StringVar Array arrDetails;
NumberVar intCount;
local StringVar strCompleteDetails := "";
local NumberVar i;
for i := 2 to intCount step 1 do
    strCompleteDetails := strCompleteDetails + arrDetails[i] + chr(13);
strCompleteDetails;
Then I combined the @DisplayArray formula with the GroupHeader and put them into the same text box in the Group Footer. I still formatted the Details section with Multiple Columns - Across then Down, and the groups are formatted with multiple columns as well...

Thanks again for your help with this.
 
One more thing, I needed to ignore the first field in the array every time - hence stepping over that first record in the loop (for i:= 2)...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top