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!

Column Breaks in Crystal Reports 3

Status
Not open for further replies.

GNHP

Technical User
Jun 8, 2006
4
US
Hi.

I apologize if this has been covered. I couldn't find it when I searched.

I have three columns on my report. The details print down and then across.

Can I add column breaks to my groups? I'd like the column to break after each group so that a new group starts in a new column.

Can this be done? Any suggestions?

Thanks!!
 
This is a little complicated. Let's say that you create a running total {#cntwingrp} which counts a recurring field {table.ID}, evaluates for every record, and resets on change of your group (on {table.grpfield}). Assuming you already have the details section formatted to multiple columns and that you also have checked "format groups in multiple columns", then place {#cntwingrp} in the detail section and observe the number of rows in a column that extends all the way to the page footer. Let's say the result is 60. Then create a formula like this:

if count({table.ID},{table.grpfield}) <= 60 and
count({table.ID},{table.grpfield}) = {#cntwingrp} then
(totext({table.ID},0,"") +
replicatestring(chr(13),61-count({table.ID},{table.grpfield}))) else

if count({table.ID},{table.grpfield}) > 60 and
count({table.ID},{table.grpfield}) = {#cntwingrp} and
remainder(count({table.ID},{table.grpfield}),60) <> 0 then
(totext({table.ID},0,"") +
replicatestring(chr(13),62-remainder(count({table.ID},{table.grpfield}),60))) else

totext({table.ID},0,"")

Use this in your detail section instead of {table.ID}. Then right click on it ->format field->common->check "Can Grow". This will force the last row in the group to grow and force the group header to the next column. If it doesn't quite work, try adjusting the height of the page footer very slightly until it does work.

Another method for doing this is to place the groupname in a group footer_a section and then use formulas in a suppressed detail section to accumulate the details and display them in the GH_b. You would place a reset formula in the suppressed group header:

//{@reset}:
whileprintingrecords;
stringvar x := "";

//{@accum} to be placed in the suppressed detail section:
whileprintingrecords;
stringvar x := x + {table.field1}+ space(25-len(table.field1}))+ {table.field2} + chr(13);

//{@display} to be placed in GF_b:
whileprintingrecords;
stringvar x;

The space(25-len({table.field}) is just used to have the second field start in a constant position. You could adjust the number as appropriate.

Be sure to format {@display} to "can grow" so all lines show.

-LB
 
The simple method is to create have empty Group Footer or and empty Group Footer subsection and then have this section checked to "Print at bottom of page". This forces the next group to start at the top of a column.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides for Formulas, Parameters, Subreports, VB, .NET, Tips and Tricks
 
Why do it the simple way, when you can make it so much more complex? :)

Ken, this is certainly the best way, and one that didn't occur to me. (*)

-LB
 
Many many thanks to both of you!

I will admit that I used Ken's method. [bigsmile]

Accomplishing this small task is a big relief.

Thanks again!!
Gillian
 
Ken(*), thats a great solution to a problem that I have encountered before. Thanks for posting it.

~Brian
 
Is there any way of accomplishing this method when your report has more than one group?

Group #1 is the category of medication, Group #2 is the medication name and includes the total amount of doses administered. The detail section is completely suppressed.

I've been playing with Ken's formulas but I haven't managed to get it to work with the multiple groups.

Any suggestions?
 
My method doesn't require any formulas.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Yes, I am in the same boat as tubbers. If there's anything additional anyone could post regarding Ken's method and multiple grouping, it would be greatly appreciated. Thank you!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top