开发者

Delphi QuickReports: Band order to achieve detail-child-child-child banding?

开发者 https://www.devze.com 2022-12-17 11:47 出处:网络
i need to create a QuickReport in Delphi 5 that is laid out as: +================ Report Header +================

i need to create a QuickReport in Delphi 5 that is laid out as:

+================
| Report Header
+================

+=========================================
| Detail Band (auto-stretching, repeats)
.
+=========================================
   |    Child band (fixed-size)
   +======================================
   |    Child band (Auto-stretching)
   .    
   +======================================
   |    Child band (fixed-size)
   +======================================

+=================================
| Report Footer (auto-stretching)
. 
+=================================

+==================================
| Report Footer (auto-stretching)
. 
+==================================

+=============================
| Report Footer (fixed size)
+=============================

Can anyone come up with with a combination of header, detail, child, footer, sub-detail, group header, group footer bands - and the associated Parent, Master, Report, Query links between them, so that i can make a report like i need it to look?

Don't confuse my use of the terms

  • header band
  • detail band
  • child band
  • footer band

to imply that any of the bands have to be of those actual types. i use those terms in the conceptual sense:

  • a single band at the start of the entire report (report header)
  • a repeating group of four bands
  • three bands that appear after all the detail, the first two being auto-stretchy

Same question, only longer

+===========================================
| Suspicious Transaction Report
|   STR No.: 12345
|      Date: 11/28/1973
|
|   Comments: as per NSL 1/13/2010
+===========================================

+===========================================
| Transaction 1 of 7
|      Buy                  Sell
|     $100.00            $16,000.00
|                        $27,000.00
|                        $12,000.00
.                            ...
+===========================================
|  Customer Information
|           Name: Shelby Lake
|        Address: 11111 S NC-HWY 111
|            DOB: 6/19/1981
|         ID No.: G123-456-789
|     Occupation: waitress
+===========================================
|  Original Transaction
|       Buy                 Sell
|      $100.00           $16,000.00
|    $3,000.00           $27,000.39
|   $64,132.69           $12,000.13
.       ...                  ...
+===========================================
|  Third Party Information
|           Name: Yugo Chavez
|        Address: 11111 S AB
|            DOB: 9/15/1934
|         ID No.: 995-1935
|     Occupation: dictator
+===========================================

...

+===========================================
| Transaction 7 of 7
.
.
+===========================================

+===========================================
| Description of Suspicious Activity
|   Customer had beedy eyes, that moved
|   rapidly from left to right. He...
.   ...
+===========================================

+===========================================
| Action Taken
|   We killed him, went through his
|   pickets, then started digging the...
. 
+===========================================





+===========================================
| 
|    Signature: _______________________
|                    Bruce Wayne
|        Title: The Batman
|  Employee ID: 1337-6669
+===========================================

i can make up some tables that mimic the example i made up:

CREATE TABLE STRs (
   StrID int,
   Number text,
   Date datetime,
   Comments text,
   DescriptionOfSuspiciousActivity text,
   ActionTaken text,
   EmployeeName text,
   EmployeeTitle text,
   EmployeeNumber text )     

CREATE TABLE STRTransactions (
   STRTranasctionID int,
   STRID int,
   BuyAmount money)

CREATE TABLE STRTransactionSells (
   STRTransactionID int,
   SellAmount money)

CREATE TABLE STRTransactionPatronInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE STRTransactionThirdPartyInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE OriginalTransactions (
   STRTransactionID int,
   BuyAmount money,
   SellAmount money )

My failed experiment

i've tried to create a QuackReport with the following band layout:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | 开发者_如何学CChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

Note: The indenting is used to help identify parent-child relationships (i.e. the band isn't actually indended 50 pixels)

The problem with this design is that, at design time at leat, the Summary band appear before the two stranded child bands:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

And when the report is run (at runtime), the two stranded child bands don't even print:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

Captcha: quackreports


(please keep in mind I no longer have QuickReports available to me, so this is all from memory)

Okay... I've run into this problem before... To give you a full coded example would take a very long time (time I simply don't have) but I'll try to describe my solution so you can relate to it.

Instead of using TQRChildBand, use all DetailBand instead. You then hook each of those bands' BeforePrint event.

You would use something like this in the BeforePrint event:

printband := FPrintSubBandA;

Use a set of universally available variables (or private members on your report's form) to define what bands should be displayed and shouldn't be for a given record showing on your report.... all of type Boolean (NOTE: You could use a SET of enums, but Booleans are easier/quicker to implement imho)

In your NeedData event, you will extrapolate which bands are required for a given record, and set those variables (Boolean values, of course) accordingly.

The entire solution is a lot of a dirty hack, but essential since QuickReports' support for nested sub-bands on selective records is essentially non-existent.

If this isn't enough information, let me know and I'll trawl through my code archives to see if I can find the one example I have of doing this. Essentially, this exact problem is the reason I switched to RaveReports instead.

EDIT: I presume you've most likely already tried setting each child band's ParentBand value at runtime... if you haven't, don't waste your time! Doing this causes even more anomalous results (I've even had Access Violations attempting this)

0

精彩评论

暂无评论...
验证码 换一张
取 消