Solved

Each group begins in new page

Posted on 2006-06-27
39
1,923 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
Comment Utility
In the format properties of Group Footer 2, turn on the option of New Page After.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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
Comment Utility
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
 
LVL 7

Expert Comment

by:ast2550
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I'm sorry friend, its not working.
0
 
LVL 7

Expert Comment

by:ast2550
Comment Utility
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
Comment Utility
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
Comment Utility
What is your {table.field} for Group1 and Group2, so I can refer to them by properly?
0
 

Author Comment

by:vishalav
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes, i used specified order for Date range.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 7

Expert Comment

by:ast2550
Comment Utility
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
Comment Utility
No luck my friend............

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

Expert Comment

by:ast2550
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
"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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
For all records the value came as 'true'. Nothing (blank) for last record.
0
 
LVL 7

Expert Comment

by:ast2550
Comment Utility
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
Comment Utility
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
Comment Utility
WhooWho!
0
 
LVL 7

Accepted Solution

by:
ast2550 earned 125 total points
Comment Utility
I meant to say WooWho!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now