lizzzard
asked on
I don't get the Qreport OnNeedData...
Hi, I have a TStringList which I want to print in a report. One subdetailline per String in the List.
So, I figured I have to use the OnNeedData event of the subdetail to print each rule.
No I have the following code:
procedure TLCRepForm.HygOpdtNeedData (Sender: TObject;
var MoreData: Boolean);
begin
if HygList.Count > ListCount then
begin
HygOp.Caption := GebouwList.Strings[ListCou nt];
Inc(ListCount);
MoreData := GebouwList.Count > ListCount ;
end;
end;
where the HygOp is a label on my subdetailrecord. I have the dataset of the subdetail empty..
I can't figure out what I'm doing wrong.. It just print nothing...
Thanks,
Lizzzard
So, I figured I have to use the OnNeedData event of the subdetail to print each rule.
No I have the following code:
procedure TLCRepForm.HygOpdtNeedData
var MoreData: Boolean);
begin
if HygList.Count > ListCount then
begin
HygOp.Caption := GebouwList.Strings[ListCou
Inc(ListCount);
MoreData := GebouwList.Count > ListCount ;
end;
end;
where the HygOp is a label on my subdetailrecord. I have the dataset of the subdetail empty..
I can't figure out what I'm doing wrong.. It just print nothing...
Thanks,
Lizzzard
just replace the listview with your stringlist and it should work fine.
Zif.
Zif.
ASKER
Hi, ZiF!!!!
Long time no see! How's it hanging?
Thanks for you comment..
I use a subdetail because it is a subdetail...
I want to report from a master/detail recorset, in which one of the fields of the detail is a DBMemo.
I want to add some comment text to each line of the memo (which I have assigned to a TStringList for my convience)...
And yes.. I have set ListCount to 0... Nice try though..
I will try your code in my report.
Regards and all the best from Holland,
Lizzzard
Long time no see! How's it hanging?
Thanks for you comment..
I use a subdetail because it is a subdetail...
I want to report from a master/detail recorset, in which one of the fields of the detail is a DBMemo.
I want to add some comment text to each line of the memo (which I have assigned to a TStringList for my convience)...
And yes.. I have set ListCount to 0... Nice try though..
I will try your code in my report.
Regards and all the best from Holland,
Lizzzard
Hi lizzzard,
all things fine here (and in Belgium too :-) ).Mmmm, can you test somehow if the subdetail band is used during report time?
Zif.
all things fine here (and in Belgium too :-) ).Mmmm, can you test somehow if the subdetail band is used during report time?
Zif.
ASKER
Zif,
I tried your solution, and it worked But I don't get what I'm doing wrong in my code..
Now I have another problem.. See my new question.. hehehe
Regards,
Lizzard...
I tried your solution, and it worked But I don't get what I'm doing wrong in my code..
Now I have another problem.. See my new question.. hehehe
Regards,
Lizzard...
ASKER
PS
do you want the points for your comment???
do you want the points for your comment???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's OK with your code, Zif.. I have to finish this project soon, So if it works, it works. I'm not normally like that.. Right now I have hellhounds on my trail..
Thanks anyway.
Thanks anyway.
ASKER
Sorry Zif...
I saw I forgot to grade you...
I saw I forgot to grade you...
have you set the ListCount to zero?
Why do you use a subdetail and not a detail? If you use a subdetail, then how is it related to the detail?
here is code that works (with ListView and Detailband):
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, QuickRpt, Qrctrls;
type
TfrmNeedData = class(TForm)
QuickRep1: TQuickRep;
QRLabel1: TQRLabel;
TitleBand1: TQRBand;
DetailBand1: TQRBand;
procedure FormCreate(Sender: TObject);
procedure QuickRep1BeforePrint(Sende
var PrintReport: Boolean);
procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
private
{ Private declarations }
SomeList: TStringlist;
CurrentIndex: integer;
public
{ Public declarations }
end;
var
frmNeedData: TfrmNeedData;
implementation
uses Unit1;
{$R *.DFM}
procedure TfrmNeedData.FormCreate(Se
var
i: integer;
begin
end;
procedure TfrmNeedData.QuickRep1Befo
var PrintReport: Boolean);
begin
// You must reset your data in the BeforePrint event
// or when you print from the preview, the report will
// start with the last value(s)
CurrentIndex := 0;
end;
procedure TfrmNeedData.QuickRep1Need
var MoreData: Boolean);
begin
// If MoreData is true, then QuickReport will print
// another detail band. When you set it to false,
// the report is done.
MoreData := (CurrentIndex < form1.ListView1.Items.Coun
if MoreData then
begin
QRLabel1.Caption := form1.ListView1.Items[Curr
// Here's how to set the progress bar
QuickRep1.QRPrinter.Progre
end
else
QuickRep1.QRPrinter.Progre
Inc(CurrentIndex);
end;
end.
Zif.