Conditional Page Break

Alc

Registered User.
Local time
Today, 06:59
Joined
Mar 23, 2007
Messages
2,421
I have a report which displays the figures for one company branch per page. Currently there's a page break after each branch's total.

My boss has requested that, if there are only two or three records per branch, the page break wait until after, say, five branches.

Is there some way to set a conditional page break of this type?
If so, what should I be looking for?

I have a vague idea, along the lines of
Code:
If (the number of totals > 5) or (number of records > 20) Then
     Page Break
else
     No Page Break
end if
But I have no idea how to implement this.

As usual, any pointers are gratefully appreciated.
 
Is the Keep Together option of no use to you? This will keep putting branches on a page until it can't fit the whole of the next branch on the page. Then that branch will be put on the next page.
hth
Chris
 
Thanks for the response.

To be honest, I haven't needed to use that functionality before, so I'm unfamiliar with how it works. I'll have a play with it and see how it goes.
 
Okay, this idea seemed promising, but I can't seem to make it do what I need. Hopefully, that's just my incompetence.

I'll try to explan it a little better, in case I wasn't clear the first time (or someone can give me a dummy's view of the 'keep together' functionality).

I have individual records and overall totals for a number of branches.
In some cases, there are thirty or more rows contributing to a total, in others there are only one or two. There's no way of knowing in advance which branches have the hugh numbers and which the low.

At present, I'm forcing a page break in the report after each total. The downside of this is that some pages only have a few rows on an otherwise blank sheet.

What I want to get the application to do is to check how many individual records there are for branch and - if the count is less than some specified number - to print multiple branches onto one report page.

I would only want to do this if ALL of the records AND the total for a given branch would fit onto a page. If adding the subsequent branch would cause that branch's details to be split over two pages, I would want to treat it as happens now and start a new page.

e.g. Assuming a maximum of 30 records + total per page (31 rows in all)
Code:
Page 1 - First 31 records Branch A
Page 2 - Last 15 records and total for Branch A
Page 3 - 10 records and total for Branch B
             12 records and total for Branch C
Page 4 - 15 records for Branch D
Page 5 - 20 records for Branch E (as would need be split, if was added to page 3)
Page 6 - 28 records and total for Branch F
etc.

Seems complicated to me, but I can't believe it's undoable.
 
What you describe you want is what Keep Together does. If you go into the Sorting And Grouping and click in the Branch row, one of the option fields at the bottom is Keep Together. If you set this to Whole Group, then the report will always try to keep that grouping level together i.e. if it can fit the whole of the group on the current page it will, if not it will start it on the next page. If a group is more than a page then it will just carry on from the last group.

I attach an example.

Chris
 

Attachments

What you describe you want is what Keep Together does. If you go into the Sorting And Grouping and click in the Branch row, one of the option fields at the bottom is Keep Together. If you set this to Whole Group, then the report will always try to keep that grouping level together i.e. if it can fit the whole of the group on the current page it will, if not it will start it on the next page. If a group is more than a page then it will just carry on from the last group.

I attach an example.

Chris
Thanks for answer and the clear example.

I've altered the report properties to match yours, but it's still displaying one branch per page, regardless of how many records there are on each page. Is there some other property that could be counteracting this setting?
 
Thanks for answer and the clear example.

I've altered the report properties to match yours, but it's still displaying one branch per page, regardless of how many records there are on each page. Is there some other property that could be counteracting this setting?
How did you implement your original page break? I'm suspecting you inserted a page break object or set the Force New Page option. But there's no need to do this. The keep Together will manage the page breaks. So remove any page breaks you have added.

Chris
 
How did you implement your original page break? I'm suspecting you inserted a page break object or set the Force New Page option. But there's no need to do this. The keep Together will manage the page breaks. So remove any page breaks you have added.

Chris
Your suspicions were well founded, sir.
I took out the forced break I had originally inserted and all looks exactly how I want.

Falls into the 'simple to do if you know how, but a pain if you don't' category .

Many, many thanks for the help.
 
Hi,
I have a report on which countries names and their delegations will appear. However, on some pages, and at the end of the page, a country can stay alone when the members of the delegation are on the other page.
I tried Keep Together but didn’t work, this because I want all countries to be continued but if one country’s name stays at the end of the page it will be forced to join its delegation members on the next page.
I tried also the conditional break based on a control specific value, but this one will break the page every time at the same place even if the country fits in the page.
Is there any thing that helps to count access report lines or controls per page so I can apply a code on it to break at a specific place of the page ?
thanks
 
Hi,
I have a report on which countries names and their delegations will appear. However, on some pages, and at the end of the page, a country can stay alone when the members of the delegation are on the other page.
I tried Keep Together but didn’t work, this because I want all countries to be continued but if one country’s name stays at the end of the page it will be forced to join its delegation members on the next page.
I tried also the conditional break based on a control specific value, but this one will break the page every time at the same place even if the country fits in the page.
Is there any thing that helps to count access report lines or controls per page so I can apply a code on it to break at a specific place of the page ?
thanks
Please create a new thread in the Reports section of the forum. Your problem is not related to this thread.

Going forward, please don't revive old threads. Create your own thread and reference that thread if you wish.
 

Users who are viewing this thread

Back
Top Bottom