Board index » delphi » Qs & Vent : Creating Quick Reports Dynamically

Qs & Vent : Creating Quick Reports Dynamically

One of my current projects is a c/s app that has a large number of
reports. I have done some reporting using Quick Reports but have never
tried to create a report dynamically until now.

There are four snippets of code in QRPT2MAN.DOC in the section
entitled 'Creating Reports By Code' that I spent this morning trying
to use. The first snippet is supposed to create a blank report using
FetchReport. It didn't take too much work to get the code to work. The
snippet was missing a end statement and was trying to free the same
object twice while leaving a second object undestroyed.

The second snippet of code also uses FetchReport. It was also missing
an end statement but that was all that was needed to get the snippet
to work. Well sorta work... The title property is set to 'Employee
List' but in the report the title is 'Employee'!

The third snippet uses QRCreateList to create a report. I should say
"tries to use" as it generates an exception because of an access
error.

var
  aReport : TQuickRep;
begin
  QRCreateList(aReport, Self, Query1, 'Employee Listing', nil);
  aReport.Preview;
  aReport.Free;
end;

In the de{*word*81} I see
aReport = (FComponentStyle:[(out of bound)7];FDoubleBuffered:True;
FInImeComposition: True)
and I assume that is the cause of the error. Going by the QR
"documentation" tells me nothing. Any ideas concerning this will be
appreciated.

The fourth snippet of code was a real winner. That snippet didn't
stand a chance of compiling without several changes being made. What
made this snippet so outstanding is that it uses a TList object as the
fifth argument for QRCreateList. That would be fine but the method
takes an object of TStrings type. HELLO?

At this point I really began to wonder what in hades is going on.
After much muttering under my breath I decided to try another snippet
in the next section.

var
   aReport : TQuickRep;
begin
   aReport := TQuickRep.Create(Self);
   aReport.Parent := Self;
   with aReport do
   begin
      DataSet := Query1;
      Bands.HasTitle := True;
      Bands.HasDetail := True;
      with Bands.DetailBand.AddPrintable(TQRDBText) do
      begin
         Size.Top := 5;
         Size.Left := 20;
         DataSet := Query1;
         FieldName := 'EmpNo'; // ??????????????????????
      end;
      with Bands.TitleBand.AddPrintable(TQRLabel) do
      begin
         Size.Top := 5;
         Size.Left := 20;
         DataSet := Query1;
         Caption := 'Employee List';
      end;
   end;
   aReport.Preview;
   aReport.Free
end;

The muttering became cursing aloud when the code wouldn't compile,
"Undeclared identifier: 'FieldName'". Jeez Louise the help file sez
that FieldName is a property of type TQRDBText.{*word*222}this, it is time
for lunch.

After lunch I said what the heck and downloaded the latest non-beta
version of Quick Reports. Even though the version was QR2.0j the
readme said to execute QR20H.exe. Better still, the readme file is
inside of the executable!

After backing up the registry, I installed QR2.0j. The installation
went smoothly and the mule I am using to test with compiled without a
whimper (the FieldName := statement was commented out). When I ran the
app in the de{*word*81} it complained that it could not find quickrpt.pas
and qrextra.pas and went nuts up.

What a bunch of {*word*99}! I uninstalled and reinstalled D3 hoping to
over-write the {*word*99} I had just installed. Ok it didn't work, so I
re-uninstalled D3 and removed all references to QR from the D3
subdirectories and from Windows\System and then reinstalled D3.  

After searching the QUSoft website I found nothing that referenced the
problems I had been having. This really lit my fuse so I decided to
purchase the Professional version so I can see the source code.
Spending a C-note of my client's money so I can get tech support is
cheaper for him than billing for hours wasted working blind!

It will be interesting to see what happens with the Professional
version. Hopefully it will be functional for creating reports
dynamically. At least I should be able to get some answers as to why 3
out of 5 attempts fail so frightfully. I would like to think Quick
Reports is a better product than what I have seen today.

If anyone can provide my with any suggestions on how to dynamically
create reports using Quick Reports, I would certainly appreciate it.
Also comments on other third party reporting tools that can be used to
dynamically create reports will be welcome as well.

Sorry for the length of this post but I just had to vent my
frustration with what I see as worthless documentation. I am
absolutely amazed that BI would package such a product with the
Client/Server suite. It adds no value AFA I am concerned (at this
time).

regards
A.G.

BTW the QUSoft home page says that since I got QR2 with D3, Borland
will provide tech support. A response from a Borland employee would be
nice to read.

 

Re:Qs & Vent : Creating Quick Reports Dynamically


Venting my frustrations concerning Quick Reports provided no answers
to my problems but sure was relieving. Thanks for allowing it!

The major problem has been lack of documentation concerning
dynamically using Quick Reports. I was finally able to create a report
using QRCreateList by first instantiating a report object. My brain
must have GPF'd as I can't figure out how I overlooked such a simple
thing. (That fact it was overlooked in qrpt2man.doc as well didn't
help either.)

Purchasing the source code allowed me to step through the code and see
what is going on. Even so I could not determine how to use
AddPrintable to add a component to a band. The source didn't hold the
answer for me and neither did the documentation. (There is little
change between the documentation of the demo and the pro version.)

I e-mailed a question to QUSoft Monday PM and the next morning I had
the answer. The documentation shows AddPrintable being used as

Quote
>      with Bands.TitleBand.AddPrintable(TQRLabel) do

but the e-mail response I received said to use it as:

Quote
>      with TQRLabel(Bands.TitleBand.AddPrintable(TQRLabel)) do

The e-mail didn't lie and the big hurdle has been cleared, I hope<g>.
Now I am able to proceed creating my dynamic reports, no more treading
water.

So  what's my take on all this? First kudos to QUSoft for the quick
turn-around on my support question. (I'll consider the first support
question as costing a c-note and all subsequent requests will be
freebies.)

I must pan Borland concerning the matter. Packaging Quick Reports with
D3 C/S in questionable in my mind. Dragging and dropping the
components onto a form works ok but to dynamically use them is
impossible given the incomplete and inaccurate documentation provided.

Also I must pan QUSoft for the documentation as well. The only
difference in the documentation between the version I received with D3
and the Professional version is the source code and a few screen
captures in the Word document.

Tools are not always intuitative. Inaccurate and incomplete
documentation is very frustrating to me and I assume others. Is the
documentation problem (global not just this instance) because of the
desire to get the products out the door close to schedule or an
unwillingness to spend the money?

regards
A.G.

PS Borland's response was to use the newgroups or to use one of their
developer support option$. Who sez MSDN is expensive?

Other Threads