can't print 1 detail per page?
RB 10.7 Enterprise.
I cannot print 1 record per page, and I need to for labelling, on 110x80mm
size labels in landscape, margins set to 5mm all round. It seems to keep
repeating the first record on every page (ad infinitum) if I set my detail
band height to the max that will fit(80-2*5=70, with no other bands), and if
I shrink it it prints say two records the first page, then reprintsd record
2 and adds record 3 onn 2nd page, then reprints record 3 and adds record 4
on 3rd page etc.
It seems to want to "reprint on overflow" even when the record is not
strictly overflowing.
Have tried adding header andf footer bands no joy, tried subreports etc.
Any help much appreciated,
regards,
Chris
I cannot print 1 record per page, and I need to for labelling, on 110x80mm
size labels in landscape, margins set to 5mm all round. It seems to keep
repeating the first record on every page (ad infinitum) if I set my detail
band height to the max that will fit(80-2*5=70, with no other bands), and if
I shrink it it prints say two records the first page, then reprintsd record
2 and adds record 3 onn 2nd page, then reprints record 3 and adds record 4
on 3rd page etc.
It seems to want to "reprint on overflow" even when the record is not
strictly overflowing.
Have tried adding header andf footer bands no joy, tried subreports etc.
Any help much appreciated,
regards,
Chris
This discussion has been closed.
Comments
Try setting the DetailBand.PrintCount to 1. This will limit the detail
band from printing more than once per page.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I tried this, and now yes I get 1 detail band per page BUT it does not
increment record count on the next page: it keeps repeating one band of the
first record on every page? (so two pass report effectively locks up on
preview, page counting to infinity- hence i have made sure pass count is
1!). I have shrunk the detail band to less than half my page height (and
its phStatic) to be sure its not overflowing page length somehow and trying
to reprint on the following page.
My datasource is a JIT and I have the following setup for the OnTrverse
event:
procedure TWspReportEdWnd.jitTraverseBy(aIncrement: Integer);
begin
m_rptIdx:=m_rptIdx+aIncrement;
end;
(m_rptIdx is my record index the JIT is accessing). OnGotoFirstRecod,
OnGotoLastRecord all setup, and it works fine if there's more than one
record per page.
Stepping through it, it seems to traverse by +1 (OK!) then by -1 (Uh-Oh!),
from the finishPage method:
procedure TppEngine.FinishPage;
begin
{indicate to engine that page has been completed}
FPageComplete := True;
{save engine state to cache}
if not(FColumnarReport) then
SaveEngineState;
{save last generated page}
FLastPageGenerated := AbsolutePageNo;
{put record on correct position for printing column footers}
PriorRecord; <<<<<<
Report.FinishPage;
Its not a columnar report (columns=1), there are no column headers or
footers, so this logic confuses me- seems backwards. Not sure why
fCalcsOutofSync would be True either?
Regards,
Chris
----- Original Message -----
Check out the JITPipeline examples in the main demo project installed with
the producDemos\Reports\Demo..dpr.
Check out the JITPipeilne tutorial in the Developers Guide.
You are using the JITPipeline incorrectly.
- use the JITPipeline Fields Editor to define the fields.
- set the JITPipeline.RecordCount property to the total number of records
- implement the OnGetFieldValue event to return the field values. Use the
aFieldName parameter and the JITPipeline.RecordIndex proeperty to return the
correct field value for the current row and requested FieldName.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I had done all as you suggest:
* fields are defined via the JIt fields editor
* recordcount is set as follows:
procedure TWspReportEdWnd.RegenActExecute(Sender: TObject);
begin
try
ppReport.CloseDataPipelines;
jit.RecordCount:=m_wsp.Parts.count+m_wsp.Plates.count;
jit.InitialIndex:=0;
ppReport.Reset;
ppReport.PrintToDevices;
except
ppviewer.reset;
setpercent(0);
setstate('Report Generation Interrupted or Failed');
end;
end;
* OnGetFieldValue implemented:
function TWspReportEdWnd.jitGetFieldValue(
aFieldName: String): Variant;
var
isPlate: boolean;
aryIdx: integer;
ext: TExtents;
begin
case nameToFieldEnum(aFieldName, m_rptIdx, isPlate, aryIdx) of
rfType:
begin
if isPlate then
Result:='Plate'
else
Result:='Part';
end;
rfName:
begin
if isPlate then
Result:=m_wsp.Plates[aryIdx].Name
else
Result:=m_wsp.Parts[aryIdx].Name;
if length(Result)=0 then
... etc
I can't see any substantial differences between this and the example, beyond
application specific functionality. As I said the report works if there is
more than 1 record per page, though the last record does get reprinted at
the top of the next page, resulting in an infinite loop if we allow only 1
rec per page...
The problem seems to be instigated by this, in TppEngine.FinishPage:
{put record on correct position for printing column footers}
if CalcsOutOfSync and not(FColumnarReport) then
PriorRecord;
There's no calculated fields that I can see, so why does it call
PriorRecord? Tracing into the ontraverseby event, every page goes forward
one record as expected, but then backward one record via FinishPage as
above, so we are stuck at record 1.
Regards,
Chris
In a prior post you had code that looked like the following.....
-----
procedure TWspReportEdWnd.jitTraverseBy(aIncrement: Integer);
begin
m_rptIdx:=m_rptIdx+aIncrement;
end;
(m_rptIdx is my record index the JIT is accessing). OnGotoFirstRecod,
OnGotoLastRecord all setup, and it works fine if there's more than one
record per page.
----------
I recommend deleting all of that code - OnTraverseBy, OnGotoFirstRecord,
OnGotoLastRecord,...
I recommend deleting m_rptIdx entirely. The JITPipeline internally manages
its RecordIndex property, you only need to read that property in the
OnGetFieldValue event. You don't need to update the property at all.
Let the JITPipeline do the work for you. Keep it simple.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
You were correct and its working fine now. Sorry for being a bit slow on
the uptake: was maintaing some legacy code written by someone else and
assumed the traverseby etc were implemented for a good reason- turns out
they weren't...
Regards,
Chris