Solved

Each group begins in new page

Posted on 2006-06-27
39
1,927 Views
Last Modified: 2012-05-05
I have two nested groups, like

Group A
      Group a
      Group b
      Group c
Group B
      Group a
      Group b
      Group c


Please advice how to print each group in new page.  My crystal version is 9.0

Thanks in advance.
0
Comment
Question by:vishalav
  • 19
  • 18
  • +1
39 Comments
 
LVL 22

Expert Comment

by:Ido Millet
ID: 16997265
In the format properties of Group Footer 2, turn on the option of New Page After.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 16998403
To avoid getting an extra blank page you might use the conditional or formula for NEW PAGE AFTER
Formula would be

Not OnLastRecord

mlmcc
0
 

Author Comment

by:vishalav
ID: 17000797
Thanks to both of you. Its worked upto some extent.
Group 1 footer is comming in new page. I want Group1 footer to continue immediately after Group 2 footer.

Group A
      Group a
      Footer a
------------------  new page
      Group b
      Footer b
------------------
      Group c
      Footer c
Footer A
--------------------
Group B
      Group a
      Group b
      Group c


Please advice how to do that.
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 7

Expert Comment

by:ast2550
ID: 17000954
You could put a condition in the X2 of the 'New Page' on Group 2.
Next({table.field}) = previous({table.field})

the table.field needs to refer to the Group1 field.  Since it will be displaying the last record in group1, the next record will be a different value.
0
 

Author Comment

by:vishalav
ID: 17001373
Can you please explain more clear.
Do i need to add the condition on Group 2 Header or Group 2 footer.

To make it clear, i showned the structure below.

Current structure:

Group A
      Group a
      Footer a
------------------  new page
      Group b
      Footer b
------------------ new page
      Group c
      Footer c
---------------------new page
Footer A  ----------------------------this should come along with the above footer (Footer c)
Group B ------------------------------Group B should in new page
      Group a
      Group b
      Group c


Required structure:

Group A
      Group a
      Footer a
------------------  new page
      Group b
      Footer b
------------------
      Group c
      Footer c
Footer A
--------------------
Group B
      Group a
      Group b
      Group c

0
 
LVL 7

Expert Comment

by:ast2550
ID: 17001493
oops.  I meant to use the Next() but not the Previous().

From the design tab, right click in the Group Footer and select Format Section.  Go to Group 2 Section Footer, it should have a check against 'New Page After' to the right of it, there is a conditional formula.  Click on the X2.  In the formula box type:
Next({table.field}) = ({table.field})

But, insert the correct table and field...the one for Group1.

So, it will create a page break as long as the next record is the same as the current record.
0
 

Author Comment

by:vishalav
ID: 17001669
I'm sorry friend, its not working.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17001805
Is it doing anything different?

Ok, I looked at your example again, you also need a 'New Page Before' selected against the Group1.Header.  I usually suppress the 'Report Header' section when doing that then, so the first page isn't blank.
0
 

Author Comment

by:vishalav
ID: 17003308
The formula is not working
Next({table.field}) = ({table.field})

When i kept that formula on Group2 footer 'New page After'.............its not giving any page breaks for any group.
I tried with 'New page before' for Group1.Header also.

Please let me know, is there anyway to do that.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17003465
What is your {table.field} for Group1 and Group2, so I can refer to them by properly?
0
 

Author Comment

by:vishalav
ID: 17003729
I referred the {table.field} properly.
First of all i didn't understand the logic of Next({table.field}) = ({table.field})
How come next record field is same as current record filed when they are in different groups.

By checking 'New page after' for Group 2 footer is working fine except the following.

Group1 footer to continue immediately after Group 2 footer.

0
 
LVL 7

Expert Comment

by:ast2550
ID: 17004053
OK, so I'll list some data as an example.

Group 1 = contact.city
Group 2 = contact.person
Details = Sales

New York.header
 - Paul.header
   -Sales for Paul in NewYork
 - Paul.footer
 - Mike.header
   -Sales for Mike in NewYork
 - Mike.footer
 - Bob.header
   -Sales for Bob in NewYork
 - Bob.footer
New York.footer
Chicago.header
 - Steve.header
   -Sales for Steve in NewYork
 - Steve.footer
 - Mark.header
   -Sales for Mark in NewYork
 - Mark.footer
 - Dave.header
   -Sales for Dave in NewYork
 - Dave.footer
Chicago.footer

So, when the 'New York' prints for the Group1.header, person=Paul even though you don't show Paul in the Group1.header.  Similarly, when Bob prints in the Group2.footer, the city=New York

Originally, you had a 'Page Break After' on Group2.  So, after every person there would be a page break.  But, that isn't quite what you want.  So, we need to fine-tune it a bit.  Crystal offers a greater level of control for the page breaks than Always After.  So, we want to find a condition that will suit us.

Next Function - it reads the next record.  So, at any point you can apply that in a formula and see what is coming.  Similarly, Previous() function can read back.  Create a new formula and put Next({Contact.City}) in it.  Then place it in a different sections of the report...also include {Contact.city} right next to it.  You can see the power of knowing the next record.

Assuming that this works, you can see that as long as the current City = New York and the Next(City) = New York, then you'll want a page break - only evaluating it at the Group2.footer.

I hope this helps.
0
 

Author Comment

by:vishalav
ID: 17004249
Thank you very much. Now i understood the logic behind the Next().

My case is little different.

Group 1 = contact.Date  -- Grouping on different date range (occurance-date - 1/1/96 - 6/30/98,  7/1/98-6/30/99, --------)
Group 2 = contact.Department
Details = Sales

DateRange1.header
 - Dept-A.header
   -Sales for DateRange1 in Dept-A
 - Dept-A.footer
 - Dept-B.header
   -Sales forDateRange1 in Dept-B
 - Dept-B.footer
 - Dept-C.header
   -Sales for DateRange1 in Dept-C
 - Dept-C.footer
DateRange1.footer
DateRange2.header
- Dept-A.header
   -Sales for DateRange2 in Dept-A
 - Dept-A.footer
 - Dept-B.header
   -Sales forDateRange2 in Dept-B
 - Dept-B.footer
 - Dept-C.header
   -Sales for DateRange2 in Dept-C
 - Dept-C.footer
DateRange2.footer


In the above scenario, the occurance-date may be different for Dept-A and Dept-B, even though both are in Same Group 1.

I hope u understood the scenario and requirement.

Thanks
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17004358
Ouch!  Ok, so instead of {Table.Field}, you'll want to use GroupName ({DateRange1}, "monthly")

But, the formula editor won't let you apply the Next() function to GroupName(...).  So, you need to two-step it.  Create a formula called G1Header or whatever you want.  And, enter it's formula as:
GroupName ({DateRange1}, "monthly")

Then in the conditional formula put Next({@G1Header}) = {@G1Header}

One last note, assuming the above works, you'll need another 'Page Break Before' Group1.header.
0
 

Author Comment

by:vishalav
ID: 17004435
I did the way you said,

Group1_PageBreak = GroupName ({Claim_MedReserves.OCC_DTE}, "daily")
next({@Group1_PageBreak}) = ({@Group1_PageBreak})

its giving the following error:

"The field has no previous or next value"

0
 
LVL 7

Expert Comment

by:ast2550
ID: 17004542
Oops.  Yeah, I just tried it and it is no good.  So, since you are grouping on Daily, we'll use that.  

Put this in a formula for easy of testing:
date(year({Claim_MedReserves.OCC_DTE}),month({Claim_MedReserves.OCC_DTE}),day({Claim_MedReserves.OCC_DTE}))

It'll strip the date out of a date/time field.

Then use it in the conditional suppression

Next({@formula}) = {@formula}
0
 

Author Comment

by:vishalav
ID: 17004662
By doing this i'am not getting any errors in the formula, but report is NOT showing page break.

My occurance dates are going to be like this

DateRange1.header
 - Dept-A.header
   -Sales(08/07/1995) for DateRange1 in Dept-A
 - Dept-A.footer
 - Dept-B.header
   -Sales(04/01/96) forDateRange1 in Dept-B
 - Dept-B.footer
 - Dept-C.header
   -Sales(04/07/96) for DateRange1 in Dept-C
 - Dept-C.footer
DateRange1.footer
DateRange2.header
- Dept-A.header
   -Sales for DateRange2 in Dept-A
 - Dept-A.footer
 - Dept-B.header
   -Sales forDateRange2 in Dept-B
 - Dept-B.footer
 - Dept-C.header
   -Sales for DateRange2 in Dept-C
 - Dept-C.footer
DateRange2.footer
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17004911
I just noticed your field name DateRange1, specifically Range.  Did you create it using Group - specified order?  If not, how?

Ugh.  I'm not seeing how you can do it.
0
 

Author Comment

by:vishalav
ID: 17004944
Yes, i used specified order for Date range.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17005070
What was your criteria for putting them in specific groups?

If you can create those groups in a formula, you might be able to still do it.

If date<1998 then "1stgroup"
elseif date >=1998 and date <2002 then "2ndgroup"
else "3rdgroup"

Then I believe you can use you Next() function to see if it is in the same group
0
 

Author Comment

by:vishalav
ID: 17008960
No luck my friend............

I can used  Next() function but its not giving the page break.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17009420
Ok, the grouping is done in the formula, right?  Place the formula on the page.  Is it changing appropriately?  Create another formula that is Next({@Formula}) and place it side by side in each section.  It is showing the data that we expect?
0
 

Author Comment

by:vishalav
ID: 17009468
Yes, i  did grouping in formula and placed that formula in group section. Its grouping as expected.

I didn't get the next part, what do you  mean by 'in each section'.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17009607
Also, did you create a formula for the Next({@formula}) function where @formula is the formula where you did the grouping.  Then, place what I'll refer to as {@next_formula} in the report as well.

We want to see the condition where the two formulas are different...the most critical time to see that the formula are different is at Group2.footer, since that is where we will put the conditional formula.  But, when I'm testing something, I like to see it from all angles.  So, I'll copy those formulas into all sections (group1.header, group2.header, details, group2.footer, group1.footer).  That way I can see if I'm missing something.  You're not trying to make it pretty, yet.  Make it work first.

So, are the formulas in Group2.footer showing different values for the last Dept in the DateRange?
0
 

Author Comment

by:vishalav
ID: 17010362
I did the way you said. I kep that formula in all the sections.
I can see the next value in all sections when the last lat record in Group1 is current one. i.e its changing according to our assumption. I can see the page break for all the groups except for the last one, But here i can see one problem, that is
Group1 footer is repeating for every Group2 footer.
I mean Group1 footer follows immediately after the Group2 footer. It shouldn't be like that. Its really Weird.

Group A
      Group a
      Footer a
------------------  new page
Footer A
      Group b
      Footer b
------------------
Footer A
      Group c
      Footer c
Footer A
--------------------
Group B
      Group a
      Group b
      Group c


I hope i'm bothering u more...........


0
 
LVL 7

Expert Comment

by:ast2550
ID: 17010531
Ok, so the formula {@Formula} that is being used to replicate the Group1Range, did you make that formula be the Group1 field?  Go ahead and do it if you haven't...it will remove one possible variable.

Are you sure the Footer A is actually printing...when looking at the preview Tab on the left margin it shows which section printed each line of data, so you verify that there isn't something else going on.

It doesn't make sense that you would see the Footer A after every Group a, b, c.  Is your Group1.header supressed?  If so, turn it back on and put something identifiable in it.  I imagine that it is no longer grouping properly (i.e. that the group is being reset after each department).
0
 

Author Comment

by:vishalav
ID: 17010683
I'm having doubt abt the Group1Range formula. See the below sample formula

If {Claim_MedReserves.OCC_DTE}< Date(1996,01,01) then "Prior to 1996"
else if {Claim_MedReserves.OCC_DTE} >=Date(1996,01,01) and {Claim_MedReserves.OCC_DTE} <Date(1996,06,30) then "Between 96"
else "3rdgroup"

According to this, it will give the group name but it won't do the proper grouping......

How to create a formula without putting it in specified groups.....

0
 
LVL 7

Expert Comment

by:ast2550
ID: 17010951
"According to this, it will give the group name but it won't do the proper grouping......"

What do you mean?  What is the proper grouping?

"How to create a formula without putting it in specified groups....."

Again, what do you mean?  You can create formulas for many things that don't invole grouping.
0
 

Author Comment

by:vishalav
ID: 17012149
I'm allmost done my friend. Just one doubt.

When we are checking Next() = current(), for the last record Next() value is comming as null(""). In that case its giving as page break.  So how to handle the last record.

Except that everything is fine.

Thanks for your help.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17012460
Change conditional formula
From:
Next({@Formula}) = {@Formula}
or
{@Next_Formula} = {@Formula}

To:
iif(isnull(Next({@Formula})) , False, Next({@Formula}) = {@Formula})
or
iif(isnull({@Next_Formula}) , False, {@Next_Formula} = {@Formula})

Depending on how you implemented it...with one formula or two.

By the way, what was the hangup that you fixed from the last time to now?
0
 

Author Comment

by:vishalav
ID: 17012682
The logic is not working. Still i'm getting page break for last record.

Comming to my solution.
I have used specified order for gouping range and also created formula for ranges to get names for groups.

@Group1_break =
If {Claim_MedReserves.OCC_DTE}< Date(1996,01,01) then "Prior to 1996"
else if {Claim_MedReserves.OCC_DTE} >=Date(1996,01,01) and {Claim_MedReserves.OCC_DTE} <Date(1996,06,30) then "Between 01/01/1996 and 06/30/1996"
else if {Claim_MedReserves.OCC_DTE} >=Date(1996,07,01) and {Claim_MedReserves.OCC_DTE} <Date(1997,06,30) then "Between 07/01/1996 and 06/30/1997"
else if {Claim_MedReserves.OCC_DTE} >=Date(1996,01,01) and {Claim_MedReserves.OCC_DTE} <Date(1996,06,30) then "Between 07/01/1997 and 06/30/1998"
-----

@NextGroup = next({@Group1_PageBreak})

In Group2 Footer "New Page After" the logic is
iif(isnull({@NextGroup}), false, {@NextGroup} = {@Group1_PageBreak})

Please advice what can be done for that last record page break.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17012772
Ok, I've never used this one before but nextisnull() might do the trick.

iif(nextisnull({@NextGroup}), false,{@NextGroup} = {@Group1_PageBreak})
0
 

Author Comment

by:vishalav
ID: 17012862
iif(nextisnull({@NextGroup}), false,{@NextGroup} = {@Group1_PageBreak})
 is giving error as "field has no previous or next value"

then tried with
iif(nextisnull({@Group1_PageBreak}), false, {@NextGroup} = {@Group1_PageBreak})
no error, but its giving page break for last record.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17013002
Yes, iif(nextisnull({@Group1_PageBreak}), false, {@NextGroup} = {@Group1_PageBreak}) is correct.

Ok, put iif(nextisnull({@Group1_PageBreak}), false, {@NextGroup} = {@Group1_PageBreak}) into a formula and drop it in the Group2.footer.  On the last group2.footer what value is it showing?
0
 

Author Comment

by:vishalav
ID: 17013150
For all records the value came as 'true'. Nothing (blank) for last record.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17013184
Ok, edit that formula and break apart the logical if

From:
iif(nextisnull({@Group1_PageBreak}), false, {@NextGroup} = {@Group1_PageBreak})

To: (ensure using crystal syntax)
If nextisnull({@Group1_PageBreak}) then
  false
else
  {@NextGroup} = {@Group1_PageBreak}

0
 

Author Comment

by:vishalav
ID: 17013391
Thank you very much my friend. Its perfectly working.

I got the report the way i want.

Thanks for your immediate response and help.

Thanks a lot.
0
 
LVL 7

Expert Comment

by:ast2550
ID: 17013431
WhooWho!
0
 
LVL 7

Accepted Solution

by:
ast2550 earned 125 total points
ID: 17013434
I meant to say WooWho!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question