Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: New Page if More than 1 Page Post Reply Post New Topic
Author Message
Collo
Newbie
Newbie


Joined: 05 May 2011
Location: Australia
Online Status: Offline
Posts: 4
Quote Collo Replybullet Topic: New Page if More than 1 Page
     Posted: 05 May 2011 at 4:16pm

Hi all - I'm only a new registered user here, but the forum has helped me out a lot - but I'm stuck with this one!

I've been searching everywhere for an answer to this but no luck. I've only got limited abilities in Crystal Reports. Using CR 2008.

I've got an invoice that is split into Services and Expenses. Expenses are detailed in a sub-report.

What I want to do is force a new page at a section before the Expenses sub report if the whole invoice is more than 1 page.

I'm currently doing this by a setting "New Page After" in section expert if Services are Not $0 and Expense are not $0. along the lines of New Page After: {Table.Services} <>0 and {Table.Expense}<>0

Problem is if there is only a couple of entries for services and a couple for Expenses, this may fit on one page, but since both are not $0 it will still force a new page. I can't really do it by forcing new page if there are more than 3 service entries, as 1 service entry could in theory take up the same space as 5 small service entries.

I've tried the following workaround, but still no luck.

Created a Page count formula that will only show the total page, so if it's 2 pages, then the number 2 will show.

NumberVar startNum := 0; ToText((TotalPageCount + startNum), 0)

I then tried to conditionally force a new page using section expert with the following:

{@PageCount}>'1'

End result is that the page will break at the section even if all info will fit on 1 page.

Hope above makes sense and hoping someone may be able to help!

Thanks

Collo

IP IP Logged
Collo
Newbie
Newbie


Joined: 05 May 2011
Location: Australia
Online Status: Offline
Posts: 4
Quote Collo Replybullet Posted: 16 May 2011 at 7:34pm
Sorry to bump it - but is there anyone that can help me on this one?
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 17 May 2011 at 3:31am
Problem is that total page count is determined after all of the records are loaded. So you don't know how many pages in total there are for your main report until after all the records have been processed.
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 17 May 2011 at 11:47am
I freely admit I'm not that good with formulas but have you tried something like:  If {@PageCount}>1 then True
             else {@PageCount}=1

If you try to place your into the formula expert you get an error message that the '1' needs a number so leave off the ' '
IP IP Logged
Collo
Newbie
Newbie


Joined: 05 May 2011
Location: Australia
Online Status: Offline
Posts: 4
Quote Collo Replybullet Posted: 23 May 2011 at 12:39pm
Thanks for that - sounds about right to me.  Looks like no way around it.

Originally posted by Keikoku

Problem is that total page count is determined after all of the records are loaded. So you don't know how many pages in total there are for your main report until after all the records have been processed.
IP IP Logged
Collo
Newbie
Newbie


Joined: 05 May 2011
Location: Australia
Online Status: Offline
Posts: 4
Quote Collo Replybullet Posted: 23 May 2011 at 12:43pm
Thanks also for this - I've not been able to get around it along these lines, sadly.

Originally posted by CircleD

I freely admit I'm not that good with formulas but have you tried something like:  If {@PageCount}>1 then True
             else {@PageCount}=1

If you try to place your into the formula expert you get an error message that the '1' needs a number so leave off the ' '
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet Posted: 02 Jun 2011 at 11:04pm
One way of doing this would be to create a record count formula with a Global variable that counts the lines per page.
Reset this variable in each report header, then base you new page creation on the record count formula. You would need to play with the new page after formula to see what will fit on each page.
 
Should do the trick.
 
Dewald Botha
http://www.ITClarity.co.za
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum