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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Break - Yes, I did it

Status
Not open for further replies.

TelesW

Programmer
Jul 15, 2002
3
BR
Hi all

This will be a long explanation about how to work around column break problem in Crystal Reports 8.0.
I didn't test this solution on other version but it seams to work fine.

Scenario:
I want to create a billing report with totals by month and by each date where month header and footer are always on first of the 3 column of a new line like this layout:

Month 01/2002
01/01/2002 3,000.00 01/05/2002 2,500.00 01/08/2002 3,500.00
01/09/2002 3,100.00 01/11/2002 2,900.00
Month Total XXXXXXXX

Month 02/2002
02/01/2002 3,000.00 02/05/2002 2,500.00 02/08/2002 3,500.00
02/09/2002 3,100.00
Month Total XXXXXXXX

Month 03/2002
03/01/2002 3,000.00 03/05/2002 2,500.00 03/08/2002 3,500.00
03/09/2002 3,100.00 03/11/2002 2,900.00 03/15/2002 5,000.00
Month Total XXXXXXXX

Solution:
The total by day is very easy to do. Simply create a group with the date field on and sum the value field. After that, go to format section and on detail section check Format With Multiple Columns and on tab Layout format section to have 3 columns, Across and Down and check Format Groups with multiple column. Done.

Now let's go to the hardest part. Break and format by month. First create a formula with year and month of the same date field you created the group by day, calling it by Original Month. Move this group and make it the Group Header #1 and create a sum total to it. This way, month header and footer can be printed on any column. Create a Running Total with distinct count of date field, evaluate on change of group #2 (Date field) and reset on change of group #1 (Month). Put RT on Date group and suppress it (RT). Create 4 formulas with the same content as month/year break formula. Call then as Month_Minus_2, Month_Minus_1, Month_Plus_1 and Month_Plus_2. Create groups for each on of them and put groups in this order:

Month_Minus_2 Group #1
Month_Minus_1 Group #2
Original_Month Group #3
Month_Plus_1 Group #4
Month_Plus_2 Group #5
Date Field Group #6
Details

Suppress Group Header #1 and #2.

On Group Header #4 and #5, open format group screen, leave Supress (No drill-Down) unchecked and edit its formulas with this code:
Code:
RunningTotal <> 1

Suppress Group Header #6 and Detail.

Create a new formula to test next break (TEST_NEXT_BREAK) with this code:
Code:
if not NextIsNull ({@Original_Month}) and {@Original_Month} = Next ({@Original_Month}) then
  true
else
  false

Put this suppressed formula on Group Footer #5. Open format section screen and on Group Footer #5 leave Supress (No drill-Down) unchecked and edit its formulas with this code:
Code:
{@Test_Next_Break} or
Remainder ({#RunningTotal}, 3) = 0

Do the same as Group Footer #5 on Group Footer #4 bu with this code on suppress formula:
Code:
{@Test_Next_Break} or
Remainder ({#RunningTotal}, 3) = 0 or 
Remainder ({#RunningTotal}, 3) = 2

If you do this I guess you can simulate the column break.

PS.: To create more columns you will need more groups, one group by column and edit suppress formulas of actual Group Footer #4 and #5.

Hope this works fine for you too.

Any trouble I'm ready to help

Wander
Brazil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top