Search code examples
crystal-reportssubreport

Subreports in Crystal Reports


Is it possible to create a single report in Crystal report showing the 3 lists that get information form only 1 main table?

This is my main table which I pulled out from a database and used full outer joins to AccountNum1 and AccountNum2, leading to the blank values in some rows:

AccountNum1 ActDate     SuspDate    AccountNum2 EntryDate   Charge
12345       01/01/2001  12/12/2012  12345       01/01/2012  1.00
67890       02/02/2002  11/11/2011  67890       02/02/2012  1.00
<Blank>     <Blank>     <Blank>     23456       03/03/2012  1.00
34567       04/04/2004  12/12/2012  <Blank>     <Blank>     <Blank>

For the 1st report, I want to display all records with complete entries:

AccountNum  ActDate     SuspDate    EntryDate   Charge
12345       01/01/2001  12/12/2012  01/01/2012  1.00
67890       02/02/2002  11/11/2011  02/02/2012  1.00

For the 2nd report, I want to display all records that have entries for AccountNum2, EntryDate, Charge only

AccountNum  EntryDate   Charge
67890       02/02/2012  1.00

For the 3rd report, I want to display all records that have entries for AccountNum1, ActDate, SuspDate only

AccountNum  ActDate     SuspDate
34567       04/04/2004  12/12/2012

I need to be able to show the information in a single report and also summarize the count of entries in report1, report2 and report3.

Thanks for all your help.:)


Solution

  • This IS possible in Crystal via a workaround:

    Add a formula that defines which section you want the row in, eg SectionNo: Formula might need changing depending on your logic

    If (Not Isnull(AccountNum) and Not Isnull(ActDate) and Not Isnull(SuspDate) and Not isnull(EntryDate) and Not Isnull(Charge) then
        1
    else if (Not Isnull(ActDate)) then
        2
    else
        3
    

    Now you can add a group by the new formula, this will separate the rows into the three sections.

    Next add two new detail sections and setup detaila, detailb and detailc to show the fields you want in sections 1, 2 and 3.

    Finally add 3 formulas to the three detail sections suppression formula:

    DetailA enter "SectionNo <> 1"
    DetailB enter "SectionNo <> 2"
    DetailC enter "SectionNo <> 3"
    

    If you need a hand setting it up let me know.