Solved

Qreport with List or Array

Posted on 1998-10-28
21
453 Views
Last Modified: 2012-06-21
According to the help docs QReport is capable of using a list or a array as a datasource.
How can I accomplish this? - Examples please!
0
Comment
Question by:hopla
  • 9
  • 9
  • 3
21 Comments
 

Expert Comment

by:gdebiasa
ID: 1344779
What I do is use QRLabels to hold my data on the report (as opposed to the data-aware versions). Then, in the OnNeedData event, I put the information from my list (for this record) onto those Captions.

Glen
0
 

Author Comment

by:hopla
ID: 1344780
So, I did, and I got the following errors while printing the report:
"Access violation at adress 00415223F in module 'TOP30.EXE'. Read of adres FFFFFFFF."

And...

"A component named QRProgressForm already exists."

What did I do wrong, or can I do to correct it?


Vincent
0
 

Expert Comment

by:gdebiasa
ID: 1344781
My guess is that you're trying to create something dynamically, and trying to create it more than once (hence the "component already exists" you got).

From the information you posted, it's impossible for me to tell you exactly what's wrong. I would try to perform the simplest possible test (like just create the report and destroy it, without using it, for example) to try to narrow down exactly what's causing your access violation (and the other error as well).

Odds are your access violation is caused by trying to reference something that doesn't exist.

Sorry I couldn't be of more help.

Glen
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 8

Expert Comment

by:ZifNab
ID: 1344782
hopla,

if you can, show us the code you wrote.

Zif.
0
 

Author Comment

by:hopla
ID: 1344783
OK here is the code...
All the QR-stuff, I've placed in/on a separate unit/form.
When printing I call Quick Report from the main unit/form, on this QR_unit.


unit QR_Unit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Qrctrls, quickrpt, ExtCtrls;

type
  TForm2 = class(TForm)
    QuickRep1: TQuickRep;
    QRSubDetail1: TQRSubDetail;
    QR_Nr: TQRLabel;
    QR_VW: TQRLabel;
    QR_Titel: TQRLabel;
    QR_Artiest: TQRLabel;
    QRBand1: TQRBand;
    QRDatum1: TQRLabel;
    QR_Promo: TQRLabel;
    QRBand2: TQRBand;
    QR_Copyright: TQRLabel;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure QRSubDetail1NeedData(Sender: TObject; var MoreData: Boolean);
    procedure QuickRep1BeforePrint(Sender: TQuickRep;
      var PrintReport: Boolean);
    procedure QRBand2BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    { Private declarations }
    TelRij: Integer;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.DFM}

procedure TForm2.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
     QRDatum1.Caption:=FormatDateTime('dddd d mmmm yyyy',Form1.DateTimePicker1.Date);
     QR_Promo.Caption:=Form1.PS_Titel.Text+' - '+Form1.PS_Artiest.Text;
end;

procedure TForm2.QRSubDetail1NeedData(Sender: TObject;
  var MoreData: Boolean);
begin
     TelRij:=TelRij+1;

     QR_Nr.Caption:=Form1.TopGrid.Cells[0,TelRij];
     QR_VW.Caption:='('+Form1.TopGrid.Cells[1,TelRij]+')';
     QR_Titel.Caption:=Form1.TopGrid.Cells[2,TelRij];
     QR_Artiest.Caption:=Form1.TopGrid.Cells[3,TelRij];

     MoreData:=TelRij<31;
end;


procedure TForm2.QuickRep1BeforePrint(Sender: TQuickRep;
  var PrintReport: Boolean);
begin
     TelRij:=0;
end;


procedure TForm2.QRBand2BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
     QR_Copyright.Caption:='Mistral Top 30. © Mistral Radio '+FormatDateTime('yyyy',Form1.DateTimePicker1.Date)+'. - Top 30 Wizzard. © HOPLA Software Development 1998, 1999, 2000, ... - Coding: Vincent Verschuren.';
end;

end.




And a piece from the main-unit (I think this will be enough, if not, let me know...)

procedure TForm1.Printpreview1Click(Sender: TObject);
begin
     Form2.QuickRep1.Preview;
end;

procedure TForm1.Print1Click(Sender: TObject);
begin
     Form2.QuickRep1.Print;
end;

procedure TForm1.Printerinstellingen1Click(Sender: TObject);
begin
     Form2.QuickRep1.PrinterSetup;
end;

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344784
Are you sure your program works if you don't include this unit?
0
 

Expert Comment

by:gdebiasa
ID: 1344785
Is Form2 being Auto-created or are you creating it manually?

If it's the latter, are you sure it's been created before you try to access the report? (That would explain the access violation.)

Glen
0
 

Author Comment

by:hopla
ID: 1344786
Yes, I'm sure!
The strange thing is, I've disabled the Progress-indicator during the printing, and I've not had the error.

By the way, Form2 is auto-created.

Another thing: "Form2.QuickRep1.PrinterSetup;" does not work!

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344787
do you use another form called QRProgressForm. Or do you use a component named like that.

Recently upgraded QR? Maybe there is some old-file left or not properly unïnstalled.

Zif.
0
 

Author Comment

by:hopla
ID: 1344788
No, but maybe I should?!?
Or do I have to buy the Proffessional version?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344789
hi Hopla,
no you don't need to buy the Pro version, but maybe you can get the upgrade version! There are freeware upgrades available at their webpage.

Zif.
0
 

Author Comment

by:hopla
ID: 1344790
I'll try it, 'course it still doesn't seem to work!
Still accesviolations... :(
The computer of a friend of mine just hang, while testing my programm...

I'll download the upgrade and will get back to you.
0
 

Author Comment

by:hopla
ID: 1344791
I've updated QuickReport, and there are no acces violations anymore during printing.
But there are a few things I still think aren't right:

* When printing, the documents do'n have a name! But I've enterd something in the ReportTitle property.

* Form2.QuickRep1.PrinterSetup; still does not show a printersetup dialog. It should, shouldn't it?

* When closing down, Windows informs me that a nameless task is still active. I think this is a part of QR that doesn't close down properly. Is there a way to "scan" for for undestroyed objects when losing down my programm an do some garbage cleaning?


Hopla
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344792
hopla, I think you better first totally remove QR and it's accompaning files and then reïnstall it so that you're sure you got all the correct files.
0
 

Author Comment

by:hopla
ID: 1344793
From the programm or from Delphi?
Where can I get a file-list?

hopla
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344794
from both to be fully sure.
0
 

Author Comment

by:hopla
ID: 1344795
What I've don is completly removed Delphi and re-installed it and updated QR. Then rebuild the executeble and I've had no problems since! So I think it works now.

Another little question...
How do I get the PrinterSetup-method (and it really shows up now!) to affect the printouts? If I click Printersetup and then set the number of printouts to, let's say 2, it still prints out 1!

hopla
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344796
Glad it works now. You call it when QR is in preview? Otherwise I don't have a clue, sorry.
0
 

Author Comment

by:hopla
ID: 1344797
Well I've got everything working propperly.
Thanks for your help!

Hopla
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344798
no prob.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1344799
May I answer this one hopla? So it's removed from the 'To Do'-list. If not just reject this answer. Regards, Zif.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now