New page based on next record's value?
I have a subreport in a summary band. The subreport contains a title band
and a detail band. The subreport is controlled by it's own JITpipeline. A
variable component on the detail band causes a new detail to be generated
when a change in its value occurs (which is based on a set of conditions in
the onCalc method -it sort of emulates a group break).
Now, I need to be able to force a page break when I reach a certain kind of
record. For example- I have RecordKindA, RecordKindB, and RecordKindC-
where RecordKindA and RecordkindB can occur in different "grouping"
combinations controlled by the variable component already present on the
detail band. RecordKindC should only occur once. So basically I want to
always incur a page break after RecordKindB, except in the case where
RecordKindC is the next record. :
RecordKindA
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = yes)
RecordKindA
RecordKindA
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = yes)
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = no since precedes
RecordKindC)
RecordKindC (summarizes all RecordKinds)
Is there a way, preferably easy :-), that I can do this? Is there an easy
way to look ahead to the next record without setting two pass and without
messing up the flow of the report?
thx,
Jan
and a detail band. The subreport is controlled by it's own JITpipeline. A
variable component on the detail band causes a new detail to be generated
when a change in its value occurs (which is based on a set of conditions in
the onCalc method -it sort of emulates a group break).
Now, I need to be able to force a page break when I reach a certain kind of
record. For example- I have RecordKindA, RecordKindB, and RecordKindC-
where RecordKindA and RecordkindB can occur in different "grouping"
combinations controlled by the variable component already present on the
detail band. RecordKindC should only occur once. So basically I want to
always incur a page break after RecordKindB, except in the case where
RecordKindC is the next record. :
RecordKindA
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = yes)
RecordKindA
RecordKindA
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = yes)
RecordKindA
RecordKindB (summarizes the RecordKindA's) (pagebreak = no since precedes
RecordKindC)
RecordKindC (summarizes all RecordKinds)
Is there a way, preferably easy :-), that I can do this? Is there an easy
way to look ahead to the next record without setting two pass and without
messing up the flow of the report?
thx,
Jan
This discussion has been closed.
Comments
group on a custom field (TppVariable) and use the TppVariable's OnGetText
event to return the group value. If this value is different than the
previous text value you assigned, it will cause a group break. Set the group
to NewPage = true. The other alternative is to use the PageBreak component
from RBAddOn. www.bancoems.com\RBAddOn.htm
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Actually, I tried this and the problem is that I got a page break both
before and after the record in question. So, to get around this, I used
this logic:
procedure VariableOnGetText;
begin
currentVal := pipelinedataset.primarykeyvalue;
if currentVal = oldVal then
bBeenHere := true;
if (
(ConditionsForRecordKindBMet = True)
and not
(IsRecordKindC)
)
then
//we've been here, this is the second time the event has fired- so
//break now, after the record in question
if bBeenHere then
text := text + 1;
end;
function IsRecordKindC: boolean;
begin
Result := false;
//Go to next record and check if RecordKindC
pipelineDataset.next;
if ConditionsForRecordKindCMet = True then
Result := true
else
Result := false;
//Return to current record
pipelineDataset.prior;
end;
The only thing is that I'm not sure about the "bBeenHere" logic- if that
will always behave the way I think it does? Also, this is a very simple
prototype I've drawn up and I'm not sure if it will behave the way I need
once I integrate it with the existing ppvariable on the detail band of the
real report(used to force a new detail record to print). Do you think
there's a better way of doing this? I can send you the prototype if you
want.
Gratefully,
Jan
variable component. This may fire more than once per record if there is any
code, either yours or ours, that uses the Text property. You can try using
your prototype's approach on your full report to find out if it will work.
There is another way you can try to cause a page break. When a detail band
has printed, you can set the detail band's OutOfSpace property to true in
order to tell the report engine that the detail band needs another page to
print on.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com