Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Quickreport: second try to preview fails

What problem can there be?
I open the preview and after closing I get only a blank sheet in the preview?
Did you solve this problem?
0
canorikurt
Asked:
canorikurt
1 Solution
 
MotazCommented:
Can you post your code that preview report here, and after preview code,
Example


Tabl1.Open...
...
QuickReport1.preview;
Table1.Close;
....

Motaz
0
 
calinutzCommented:
The problem you have is probabely that you forgot to link the datasource to the report form  and to the report. You have to include your datamodule (or the form that contains your datasources) into the report form (uses clause)
   I work a lot with QuickReport and I had this kind of errors on my screen a couple of times.
    Cheers.
0
 
jturpinCommented:

You may need to ensure that either a TQRBand or a TQRGroup has something to show. Try dropping a TQRLabel just to test it.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
canorikurtAuthor Commented:
Thank you all!
The problem was solved by setting the QReport.tag to zero after in my OnNeedData event there is:

  if QReport1.tag=0 then
    begin
    MoreData:=true;
    QReport1.Tag:=1;
    end
  else
    MoreData:=false;

But now I can see a more problematic preview. The QRLabels I use for displaying my data are still on the preview.

How can I blank my preview canvas. Is there a canvas?

Alternative question: how can I release created QRLabels on the fly? Is there a handle (e.g. 0..50) to count back and free the methods?
0
 
MotazCommented:
You should clear it's data:

QRLabel1.Caption:= '';

If you are creating these labels at run time then you should assign nil in Owner, and put save all of them in a list:

public
  QRLabels: array of TQRLabel;



while you creating them:

var
  Lab: TQRLabel;
begin
for i:= 1 to 10 do
begin
  SetLength(QRLabels, Length(QRLabels) + 1);
  Lab:= TQRLabel.Create(nil);
  Lab.Parent:= QuickReport1; // Or band
  Lab.Caption:= 'put your data here';
  QRlabels[High(QRLabels)]:= Lab;
end;
end;

Then when you close your report release all created labels:

for i:= 0 to High(QRLabels) do
  QRLabels[i].Free;
SetLength(QRLabels, 0);

Motaz
0
 
Dj_FrogmanCommented:
Do not do anything of that.
Insert a line before preview:

Quickreport.prepare;

Tha will do the catch.
0
 
CleanupPingCommented:
canorikurt:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
snehanshuCommented:
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: Motaz

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now