Board index » delphi » Quickreports- field to determine no of printed copies of record in table

Quickreports- field to determine no of printed copies of record in table

Is there a way to get Quickreports to print a number of copies of each
record in a table determined by a field in the record.

I would guess I need to design my own preview, but can anyone help me
futher.

THanks in advance.

(the problem relates to manufactured dining settings and needing a delivery
tag for each item in the setting)

Leon Sinagra

 

Re:Quickreports- field to determine no of printed copies of record in table


Quote
Leon Sinagra wrote:

> Is there a way to get Quickreports to print a number of copies of each
> record in a table determined by a field in the record.

> I would guess I need to design my own preview, but can anyone help me
> futher.

> THanks in advance.

> (the problem relates to manufactured dining settings and needing a delivery
> tag for each item in the setting)

> Leon Sinagra

What you may need to do is use the OnNeedData event for the report.  In
order for this to be called, you will have to remove the Dataset
property.  Then the report will call your OnNeedData event each time it
should be printing the Detail band.  You will have to set up some
counters and only skip to the next record when the counter is equal to
the field in the record.  When you reach the end of file, you will have
to manually set the MoreData variable to False to let the report know
that it is done.  I know there is an example of this in the printed
manual but it may be in the online help too.

The downside to this method is that the progress bar at the bottom of
the report does nothing because you are controlling the processing of
the file.  The only way to get around this is to create a temporary
database file and copy each record into the temp file X number of times
and then run the report on the temp file and delete it.

HTH

Trevor Radke
Syntec Business Systems, Inc.
Edmonton, AB   Canada

Re:Quickreports- field to determine no of printed copies of record in table


don't set the table as table of the report but step trough this data in the
OnNeedData event.

--
Greatings Andr Mens  Author of QReport Artist
EMail mens...@wxs.nl
Homepage http://home.wxs.nl/~mensand

Leon Sinagra heeft geschreven in bericht <71i3k5$...@forums.borland.com>...

Quote
>Is there a way to get Quickreports to print a number of copies of each
>record in a table determined by a field in the record.

>I would guess I need to design my own preview, but can anyone help me
>futher.

>THanks in advance.

>(the problem relates to manufactured dining settings and needing a delivery
>tag for each item in the setting)

>Leon Sinagra

Re:Quickreports- field to determine no of printed copies of record in table


Trevor,
I have a bunch of reports that use the OnNeedData event and I hated that the
progress bar did not show the progress so I made some modifications to the
source to be able to get it to work.  Here are the changes:

These changes are for QR2.0 only.
In QUICKRPT.PAS:

Add the following line to the "private" section of the TQuickRep
declaration.
    FNoDataRecCount: Integer;

Add the following line to the "public" section of the TQuickRep declaration.
    property NoDataRecCount : Integer read FNoDataRecCount write
FNoDataRecCount;

In the TQRController.Execute method add the following line of code to the
"else" part of the "if DSOK then" statement just after the call to
OnNeedData.
    if assigned(FOnNeedDataEvent) and not (csDesigning in ComponentState)
then
        OnNeedData(SelfCheck, MoreData);
    RecCount := ParentReport.NoDataRecCount;   {<<< add this line}

In the TQRController.Execute method add the following line of code to the
end "while MoreData do" block.
    if DSOK and (ParentReport.DataSet = DataSet) and (RecCount <> 0) then
        ParentReport.QRPrinter.Progress := (Longint(DetailNumber) * 100) div
RecCount
{<<<  add the next 2 lines >>>}
    if (not DSOK) and (RecCount <> 0) then
        ParentReport.QRPrinter.Progress := (Longint(DetailNumber) * 100) div
RecCount

Then in your report's OnNeedData event, add a line like:
    QuickRpt1.NoDataRecCount := 15;

 I've been using this since QR2 was initially released and I have a slightly
different method for QR1.  I don't have QR3 so I don't know what would be
required to make it work for it but you should be able to figure it out.

--
Scott

Quote
Trevor Radke <syn...@oanet.com> wrote in message

news:363DE60D.6471@oanet.com...
Quote
>The downside to this method is that the progress bar at the bottom of
>the report does nothing because you are controlling the processing of
>the file.  The only way to get around this is to create a temporary
>database file and copy each record into the temp file X number of times
>and then run the report on the temp file and delete it.

Other Threads