vishalav
asked on
Each group begins in new page
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.
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.
In the format properties of Group Footer 2, turn on the option of New Page After.
To avoid getting an extra blank page you might use the conditional or formula for NEW PAGE AFTER
Formula would be
Not OnLastRecord
mlmcc
Formula would be
Not OnLastRecord
mlmcc
ASKER
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.
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.
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.
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.
ASKER
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
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 --------------------------
Group B --------------------------
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
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.
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.
ASKER
I'm sorry friend, its not working.
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.
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.
ASKER
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.
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.
What is your {table.field} for Group1 and Group2, so I can refer to them by properly?
ASKER
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.
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.
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.
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.
ASKER
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
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
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.
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.
ASKER
I did the way you said,
Group1_PageBreak = GroupName ({Claim_MedReserves.OCC_DT E}, "daily")
next({@Group1_PageBreak}) = ({@Group1_PageBreak})
its giving the following error:
"The field has no previous or next value"
Group1_PageBreak = GroupName ({Claim_MedReserves.OCC_DT
next({@Group1_PageBreak}) = ({@Group1_PageBreak})
its giving the following error:
"The field has no previous or next value"
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_MedReserv es.OCC_DTE }),month({ Claim_MedR eserves.OC C_DTE}),da y({Claim_M edReserves .OCC_DTE}) )
It'll strip the date out of a date/time field.
Then use it in the conditional suppression
Next({@formula}) = {@formula}
Put this in a formula for easy of testing:
date(year({Claim_MedReserv
It'll strip the date out of a date/time field.
Then use it in the conditional suppression
Next({@formula}) = {@formula}
ASKER
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
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
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.
Ugh. I'm not seeing how you can do it.
ASKER
Yes, i used specified order for Date range.
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
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
ASKER
No luck my friend............
I can used Next() function but its not giving the page break.
I can used Next() function but its not giving the page break.
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?
ASKER
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'.
I didn't get the next part, what do you mean by 'in each section'.
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?
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?
ASKER
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...........
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...........
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).
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).
ASKER
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.....
If {Claim_MedReserves.OCC_DTE
else if {Claim_MedReserves.OCC_DTE
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.....
"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.
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.
ASKER
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.
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.
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?
From:
Next({@Formula}) = {@Formula}
or
{@Next_Formula} = {@Formula}
To:
iif(isnull(Next({@Formula}
or
iif(isnull({@Next_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?
ASKER
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.
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
else if {Claim_MedReserves.OCC_DTE
else if {Claim_MedReserves.OCC_DTE
else if {Claim_MedReserves.OCC_DTE
-----
@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.
Ok, I've never used this one before but nextisnull() might do the trick.
iif(nextisnull({@NextGroup }), false,{@NextGroup} = {@Group1_PageBreak})
iif(nextisnull({@NextGroup
ASKER
iif(nextisnull({@NextGroup }), false,{@NextGroup} = {@Group1_PageBreak})
is giving error as "field has no previous or next value"
then tried with
iif(nextisnull({@Group1_Pa geBreak}), false, {@NextGroup} = {@Group1_PageBreak})
no error, but its giving page break for last record.
is giving error as "field has no previous or next value"
then tried with
iif(nextisnull({@Group1_Pa
no error, but its giving page break for last record.
Yes, iif(nextisnull({@Group1_Pa geBreak}), false, {@NextGroup} = {@Group1_PageBreak}) is correct.
Ok, put iif(nextisnull({@Group1_Pa geBreak}), false, {@NextGroup} = {@Group1_PageBreak}) into a formula and drop it in the Group2.footer. On the last group2.footer what value is it showing?
Ok, put iif(nextisnull({@Group1_Pa
ASKER
For all records the value came as 'true'. Nothing (blank) for last record.
Ok, edit that formula and break apart the logical if
From:
iif(nextisnull({@Group1_Pa geBreak}), false, {@NextGroup} = {@Group1_PageBreak})
To: (ensure using crystal syntax)
If nextisnull({@Group1_PageBr eak}) then
false
else
{@NextGroup} = {@Group1_PageBreak}
From:
iif(nextisnull({@Group1_Pa
To: (ensure using crystal syntax)
If nextisnull({@Group1_PageBr
false
else
{@NextGroup} = {@Group1_PageBreak}
ASKER
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.
I got the report the way i want.
Thanks for your immediate response and help.
Thanks a lot.
WhooWho!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.