Link to home
Start Free TrialLog in
Avatar of pwillems
pwillems

asked on

Quick report - 2 SQL queries

Hello,

I want to make a quick report in Delfi 3. In this quick report
there should come a line from one query followed by one or more lines from another query.

I am new to Delfi, but have much experience with other programming platforms.

I have to use queries because the data is in several tables.

However to simplify the problem consider it to be :

Query 1 : select name from customers
Query 2 : select amount from order

I would of course want the two queries to be linked, thus query 2 should be something like
select amount from order where customId = customers.customid.

How do I excatly set up the bands (title band, detail band,...) in order to accomplish this.

Is there a good description of the quick reports available?

Thanks
Avatar of Greedy
Greedy

What exactly do you want to do.  Do you know what the different bands do.  One detail band will be printed for each record in the table that you have selected as the reports dataset.  Oh it's is also important that you go get the Quick Reports 2.0j it is the latest one out for non registered useres of the delphi version of quick reports (2.0k if regestered)  You actualy have many ways to do this but what I would probably do is set the dataset proporty of the report to the table that you want each band to print and then use a QRLabel to output the text that you want.  The text to put into the QRLabel will be caculated in the Before print event of the detail band.  so you can do something like this
QRLAbel1.Caption := MyFattyAssQuery.Result
or the equivalent :)
alternatly you could not put a DataSet in for the report and then make your own custom OnNeedData Event for the form...this is a bit more complictadted for a "first timer"
just ask another question if you have a problem.

Avatar of pwillems

ASKER

Hello,

I did buy Delfi 3 10 days ago. I suppose I have the latest version
of the quick report. If not, how can I obtain it (legally).

I think the answer you give does not suit my needs. I do not use
QRlabels for the results of a query but I get the data in automatically while the report prints. However, I get a correct detail band but under it always the same (and thus except for the first) wrong subdetail band.

It is the linking between detail band and subdetail band which gives me trouble.

Another point which gives me trouble is that I can not find the manual for the quick report.

Thanks

Paul
Pwillems,

Look at the demo's QR itself gave about subdetail bands ...

Regards, ZIF.

The manual for Quick reports is on the CD callled Qrpt2man.doc in the \Runimage\DELPHI30\QUICKRPT directory
get the latest copy of quick reports from www.qusoft.com
You most likely have 2.0g you will want 2.0j the way to tell what you have it to right click on the TQuickRep component on the form...not on a band do it outside the margins the popup menu that comes up will tell you the version you can click on it and it brings you to an about box that has the URL that you can click on then go to the download section and pick the one for the delphi users and you'll be fine.  Subdetail band listing isn't too bad once you've seen one work they have a new sample program there too.


pwillems

What you can try is select the option you dropped on the report e.g. QrCustomerDBText
then under data set choose one of the Sql Q... you dropped on the form...

Then under the Sql query type the query you wish to run
SELECT 'Customer' from cust.db etc................

Previewbutton.click..........
execute the query and when you call the report qreport1.preview; then the Sql will be run

Later
BoRiS

I was able to do the requested report with the two queries.
It was the comments of Greedy who showed the way I did it.
So, I would like Greedy to answer, so that I can valuate the comments.
ASKER CERTIFIED SOLUTION
Avatar of Greedy
Greedy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial