Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Qreport with List or Array

Posted on 1998-10-28
21
Medium Priority
?
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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