Quick Report Question : Group by a certain field? 
Author Message
 Quick Report Question : Group by a certain field?

I am new to Quick Report, and have managed through trial an error to
assemble a few basic reports..

I want to create a customer report grouped by city..

I have a secondary index called "ByCity" using the CITY field.

I would like one band to show the cities contained in the table, and
below it, all the customers that are located in that city..

Can someone please outline this process?
Also: Is there any books available on Quick Report?

Thanks alot!

Rkr
--

          \|||/
          /'^'\
         ( 0 0 )
-----oOOO--(_)--OOOo----------
Reid Roman
E-Mail : rkroman (at) pacbell (dot) net
delphi Enthusiast, Hobbiest ..
TVisualBasic:=class(None);
U.S.A
------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Quick Report Question : Group by a certain field?

   The answer would depend on which version of QuickReport you are using, 1.0 or 2.0.  QR
2.0 came out with Delphi 3 and it has changed significantly.

   In QR 1.0, you drop a QRGroup and a QRBand onto the form, then change the band's
BandType Property to rbGroupHeader.  Set the QRGroup's HeaderBand Property to the
QRBand's Name.  Also, set the QRGroup's DataSource and DataField properties.

  { Properties set in the Object Inspector }
  QuickReport1.DataSource := DataSource1;
  DataSource1.DataSet := Query1;
  Query1.DataBaseName := 'DBDEMOS';
  Query1.SQL.Clear;
  Query1.SQL.Add('Select * From Country Order By Continent, Name, Capital');

  QRBand1.BandType := rbGroupHeader;        { NOTE: The default is rbTitle }

  QRGroup1.HeaderBand := QRBand1;
  QRGroup1.DataSource := DataSource1;
  QRGroup1.Level      := 0;
  QRGroup1.DataField  := 'Continent';

  QRBand2.BandType := rbDetail;             { NOTE: The default is rbTitle }

Check my web page in Delphi 2 for TstQR.zip.

   In QR 2.0 (D3), Create a DetailBand by setting QuickRep1.Bands.HasDetail to True.
Drop a QRGroup on the form.  The Master property will be set to QuickRep1.  Set
QuickRep1.DataSet := Query1 (for example).  Now set QRGroup1.Expression to the column
from Query1 to be grouped (City).  

  { Properties set in the Object Inspector }
  QuickRep1.DataSet := Query1;
  Query1.DataBaseName := 'DBDEMOS';
  Query1.SQL.Clear;
  Query1.SQL.Add('Select * From Country Order By Continent, Name, Capital');

  { Create a DetailBand by setting QuickRep1.Bands.HasDetail to True }

  QRGroup1.Master     := QuickRep1;    { Set when created }
  QRGroup1.Expression := 'City';

QRGroup1's Master is QuickRep1 and QuickRep1's DataSet is Query1.  So QRGroup1's
Expression can be column name from Query1.

That should work.  I've been beating my head against QR2.0 for 2 weeks and just recently
got it working.  I started by dropping Bands on the report and changing the BandType to
rbDetail, rbPageHeader or rbTitle.  But it never worked right.  When I started creating
bands by setting the QuickRep1.Bands.HasDetail or HasTitle, it started working - I don't
know why.

O, apparently QR2.0 can have ONLY one Detail band on a report, all other bands must be a
Header, Title, Child or whatever.

--
                                                            Cleon.

<http://www.ionet.net/~baileyct>


Quote:
> I am new to Quick Report, and have managed through trial an error to
> assemble a few basic reports..

> I want to create a customer report grouped by city..

> I have a secondary index called "ByCity" using the CITY field.

> I would like one band to show the cities contained in the table, and
> below it, all the customers that are located in that city..

> Can someone please outline this process?
> Also: Is there any books available on Quick Report?

> Thanks alot!

> Rkr
> --

>           \|||/
>           /'^'\
>          ( 0 0 )
> -----oOOO--(_)--OOOo----------
> Reid Roman
> E-Mail : rkroman (at) pacbell (dot) net
> Delphi Enthusiast, Hobbiest ..
> TVisualBasic:=class(None);
> U.S.A
> ------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Quick Report Question : Group by a certain field?

You need your query to be Ordered by City and then by Customer. Use a
QrGroup band to break on the City field, maybe display the city name
there, put the customer info in the Detail band. All versions of QR
have a demo which shows how to do this (it's easier in QR2).

Nick Spurrier (MoDESoft, UK)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Quick report group probs and questions

2. quick reports quick questions!

3. Quick Reports Composite report Delphi 7 question

4. Quick Report Multi-Page Grouping Problem

5. Quick Reports - grouping multiple levels?

6. Anybody knows how to create multiple group in Quick Report (A group inside another group) ?

7. Question regarding Quick Report and runtime packages

8. Quick Report Question

9. Quick Report and RTF or Formatted memo fields

10. Quick Report Question

11. Quick Reports Question

12. Quick Report or TQuery calculation question

 

 
Powered by phpBB® Forum Software