Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Dynamic Page Break to Groups 1

Status
Not open for further replies.

RikHess

MIS
Jul 25, 2002
69
US
I am trying to add a dynamic page break feature to a report that already has dynamic grouping, but I am having a problem.

As some background, this report has a parameter for grouping that is used to control the printing of the group header and footer sections which work fine. The original design was not to have page breaks after the group footers.

Now some users have requested an option to allow them to force a page-break after the group footer on demand. This would be controlled by another parameter to indicate whether the report should have a page-break after the group footer or not.

Since the Grouping and Sorting Properties do not seem to allow an expression to control the "Page Break at end" option, I tried to use a new field that was built by the Stored Procedure which prepares the data set. After adding the parameter, when it was selected I put a CHAR(12) -- the old Form Feed ASCII Code -- into a report field in the group footer.

Unfortunately this only printed out an open box character on the report.

Does anyone have a suggestion?

Thank you.
 
vbcrlf is the standard hard return. Try that instead of char(12).
 
My apologies RikHess,

I think I misread what you are trying to do. I suggest you create a second group and conditionally display or suppress the entire group line based on the "group page break" parameter. For example

Group Page Break y/n and your user chooses "Y" they want the page break.

Structure the report like this:

Group 1: Group by field 1, field 2
Next, select entire Group1 row and in hidden enter something like =iif(Parameters!GroupPageBreak.Value = "Y",True,False)

Add a Group 2 and Group by the same field 1, field 2 as above.
In this group, define page break at end of group.
Then select entire Group2 row and in hidden field enter the opposite of your statement above.
=iif(Parameters!GroupPageBreak.Value = "Y",False,True)

Try that out and let me know if you have any questions.
 
Thank you rose4567. Your suggestion is a good one. But I am having trouble making it work.

I now have two group footer lines: first one that prints if no page break is requested, and secondly one that should print with a page break.

However I am not getting the page break on output when it is requested by parameter.

I have tested that the correct footer is being printed, so the problem seems to be in how I am setting up the page break.

What I have done on the second footer is to right-click on an open spot in the rectangle, select Properties, and click the "Insert after rectangle" on Page breaks, then OK.

But I don't get a page break when I preview the report.

Any ideas?


 
What I have done for this is setup a dummy group that doesn't display above the group you want page breaks. Below, you'd want a page break for each Group 2.

1. Group 1
2. Dummy Group
3. Group 2

The dummy group would group by a variable.
Code:
=IIF(Parameters!Break.value = 1,Fields!Group2Field.value,"")

Then select the page break after group for the dummy group. The only downfall here is that an extra page will get generated when you do not want page breaks.
 
If you prefer to avoid page breaks you could simply generate two reports, one with page breaks and one without.

Create a third report to use as your main report and keep your page break/non page break reports as subreports. Conditionally suppress or display the appropriate subreport based on the parameter value.

If you use the same query in the main report you can still pass all the other parameters too.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top