Solved

Qreport with List or Array

Posted on 1998-10-28
21
448 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
hopla,

if you can, show us the code you wrote.

Zif.
0
 

Author Comment

by:hopla
Comment Utility
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
Comment Utility
Are you sure your program works if you don't include this unit?
0
 

Expert Comment

by:gdebiasa
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
No, but maybe I should?!?
Or do I have to buy the Proffessional version?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
From the programm or from Delphi?
Where can I get a file-list?

hopla
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
from both to be fully sure.
0
 

Author Comment

by:hopla
Comment Utility
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
Comment Utility
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
Comment Utility
Well I've got everything working propperly.
Thanks for your help!

Hopla
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
no prob.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

9 Experts available now in Live!

Get 1:1 Help Now