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
Solved

Qreport with List or Array

Posted on 1998-10-28
21
455 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
When I am typing into a TEdit last word repeats 7 145
Dev express lookupcombo 3 35
PHP preg_replace code convert to Delphi 14 66
Installshield for Embarcadero EX 10.1 Berlin 4 60
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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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