Group start only ODD new page
Hi all,
Our customers are very demanding....
Lets say that we have an end-user report (D5, RB 7.03, DOA) with a group
with "start new page" enabled.
That's fine.
But our customer needs that new page always starts on the odd page number.
So if we see that the new page will be even, we should force another
page break.
The report is already two-pass, so I guess it should be possible by rap,
but which is the best approach?
Thanks in advance
Bye
Nicola
Our customers are very demanding....
Lets say that we have an end-user report (D5, RB 7.03, DOA) with a group
with "start new page" enabled.
That's fine.
But our customer needs that new page always starts on the odd page number.
So if we see that the new page will be even, we should force another
page break.
The report is already two-pass, so I guess it should be possible by rap,
but which is the best approach?
Thanks in advance
Bye
Nicola
This discussion has been closed.
Comments
See article below. First get it working using Delphi code. Then you can
modify it to work in RAP.
------------------------------------------------------
Article: Forcing Group Headers to Start on Odd Pages
------------------------------------------------------
Question:
I have a report that is printing duplexed
and therefore I want to force the group headers to
start on odd pages.
Solution:
Using demo report #71 do the following:
1. Add a subreport to the GroupFooter band, just below the existing
controls.
2. Set the subreport's PrintBehavior property to pbSection - do not add any
controls to the subreport - leave it blank.
3. Add a Private field to the form: FPrintingSpacer: Boolean.
4. Add an event handler for the FormCreate event with the following code:
FPrintingSpacer := False;
5. Add an event handler for the ppOrderDetailGroupFooterBand1BeforePrint
event with the following code:
if not FPrintingSpacer then
begin
ppSubReport1.Visible := odd(ppOrderDetail.AbsolutePageNo) and
not ppOrderDetailGroupFooterBand1.Overflow;
FPrintingSpacer := ppSubReport1.Visible;
end
else
FPrintingSpacer := False;
6. Run the project and view report #71.
Note that when a group is to start, it will only start on an odd page.
Caveats: We are brute-forcing this solution by causing the even numbered
page to be taken up by the section style subreport. As a result, any page
headers or footers you have in the main report will not appear on the even
pages that are blank. To get around this, you could add identical
header/footers or custom header/footers with only page numbers, or some
such.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Trying to add Odd(X) function to rap I see the tutorial and add the
following code (it is quite short so I write down here, hope you don't
mind).
It doesn't work. (unable to compile Odd program at runtime)
I don't see where is the difference between this code and the tutorial
(and I am unable to find documentation for GetParamValue and alike)
unit uILRAPfuncs;
interface
uses
Forms, raFunc, ppRTTI;
type
TILFunction = class(TraSystemFunction)
public
class function Category : string; override;
end;
TILOdd = class(TILFunction)
public
procedure ExecuteFunction(aParams : TraParamList); override;
class function GetSignature : string; override;
end;
implementation
{ TOddFunction }
class function TILFunction.Category: string;
begin
Result := 'Info Line';
end;
{ TILOdd }
procedure TILOdd.ExecuteFunction(aParams: TraParamList);
var
bResult : boolean;
x : longint;
begin
GetParamValue(0, x);
bResult := odd(x);
SetParamValue(1, bResult);
end;
class function TILOdd.GetSignature: string;
begin
Result := 'function Odd(X : longint) : boolean';
end;
initialization
raRegisterFunction('Odd', TILOdd);
end.
In your function declaration you need a semicolon at the end. Should be like
this:
'function Odd(X : longint) : boolean;'
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I created a simple example that you can download.
http://www.digital-metaphors.com/tips/StartGroupsOnOddPages.zip
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Trying to explain
My structure is different from this example.
I have a unique report with 3 groups (0, 1, 2)
I need:
1) the header of group 0 always on a odd page and alone. Data should
begin on the next page
2) the header of group 1 must also go on odd page only, but his data can
begin immediately
For example:
page1
First header group 0
page break
page 2
group 1 header
group 1 data
before printing the next group 0 header we should test the page number.
If even ok, if odd need another break.
I tried to put the subreport on the footer of group 0 and in the
group0footerBeforePrint the logic but it seems as the subreport gets
printed only once at the end of report, not for each group 0 break.
The subreport in the group[0] footer band seem to work.....
But it doesn't trigger on the very very first group item
and it may be correct! (because the first group item doesn't have any
previous, doesn't it?)
So my question becomes: which is the best way to force this behaviour
even in the first occurence? Do I neeed to move the subreport in the
header group band ?
Thanks
Bye
Nicola
I experimented with another technique that might be work better. Try using
the GroupHeader.BeforePrint to check whether the header should print and set
Band.OutOfSpace if it should generated a page break.
Example:
if not Odd(ppReport1.AbsolutePageNo) and ppReport1.Groups[0].FirstPage
then
ppGroupHeaderBand1.OutOfSpace := True;
BTW, in you description you state that group 1 must also go on an odd page,
but in the example you are putting it on page 2.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
As always, first get it working using Delphi code.
Not all properties and methods are defined to RAP - this is by design. You
can extend RAP by coding pass thru functions.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
1. I do not know why RAP would compile and then not work properly. You are
correct in that should not happen.
2. I think you need to add some more logic to the event-handlers. You need
to add some add some code in the outer group (Group0) BeforePrint to set
something like
FGroup0HeaderGenerated := False
Then in the AfterPrint event for Group0
FGroup0HeaderGenerated := True
Then in the Group1Header BeforePrint you can check whether the Group0Header
just printed on the page and determine whether to generate an additional
page break.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks for the feedback.
ReportBuilder is powerful and flexible - it can do many complex reports that
other tools cannot. However, it is not a perfect tool - like all software it
can be improved infinitely.
You have an unusual requirement I do not think this would be simple in any
reporting tool.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com