Emulating Nested Subreports

Troubleshooting

graphics/troubleshooting_icon.jpg

Formatting the Details of a Subreport

I can't figure out how to format the details of a Subreport.

Open the Design tab for that Subreport from within the Designer of the main report. This can be accomplished by right-clicking on a Subreport and selecting the Edit Subreport option.

Crystal Reports in the Real WorldNesting Subreports

Often a single report needs to show data from different and often unrelated pieces of information. In the next example, the report shows both customer and supplier information for a given location. This is demonstrated using a main report for the structure of Country, Region, and City hierarchy, one Subreport to show customer information, and another Subreport for supplier information. Because there is no relationship between suppliers and customers, at least one of these pieces of information must come from a Subreport. For this sample, both elements come from a Subreport. Follow these steps to explore this capability:

  1. Open the report designer and select Create New Report Using the Report Wizard. Click OK and browse to the datasource Xtreme Samples Database 10 datasource, expand the list of tables, and add the Customer table to the list of report tables by clicking the > button. Click Next.
     
  2. In the Fields window, add the fields Country, Region, and City to the report and click Next. In the Grouping window, add the same fields to the Group By list.
     
  3. Click Finish to complete the report. This builds the hierarchy that is used in the report.
     
  4. Change to Design mode. Move the fields in the group header to the left and indent them slightly at each lower level. Suppress all sections of the report other than the headers and expand each of the header areas below the fields. See Figure 12.11 to view what the framework of the report should look like.
     

    Figure 12.11. Report hierarchy to act as the framework for Subreport content.

    graphics/12fig11.jpg  
  5. With the framework complete, the next step is to create the content. There are different ways to create Subreports; in this instance, the reports are generated as separate files and later imported into the main report. Create the report for supplier information. From the File menu, select New. When the Crystal Reports Gallery window opens, click OK. Find the Xtreme Sample Database 10 connection, browse the list of tables for the Supplier table, and click the > button to move it to the list of selected tables. Click Next. From the Fields window, select Supplier Name and Phone and click the > button to move them to the Fields to Display. Click Finish to close the wizard. Minimize report content by changing to Design mode, moving the fields to the left edge, suppressing sections with no fields, and minimizing whitespace. Figure 12.12 illustrates a sample Subreport.
     

    Figure 12.12. Supplier information Subreport, extra whitespace reduced to a minimum.

    graphics/12fig12.jpg  
  6. Repeat step 5 for the customer table.
     
  7. Add each Subreport to the report three times, once each for Country, Region, and City. Drill into each of the six Subreports by double-clicking and again suppress blank sections.
     
  8. From the Report menu, select Section Expert. In the list of sections, select Group Footer #1 and check New Page After. Click OK to close the window. Save the report as Chap12SubsContext_Main.rpt. The design of the report should look like Figure 12.13.
     

    Figure 12.13. Report with hierarchy and Subreports.

    graphics/12fig13.jpg  

Preview the report and notice on Page 13 (Canada) that there is different and unrelated information for both Suppliers and Customers listed and that the information for both is specific to the location context.

Part I. Crystal Reports Design

Creating and Designing Basic Reports

Selecting and Grouping Data

Filtering, Sorting, and Summarizing Data

Understanding and Implementing Formulas

Implementing Parameters for Dynamic Reporting

Part II. Formatting Crystal Reports

Fundamentals of Report Formatting

Working with Report Sections

Visualizing Your Data with Charts and Maps

Custom Formatting Techniques

Part III. Advanced Crystal Reports Design

Using Cross-Tabs for Summarized Reporting

Using Record Selections and Alerts for Interactive Reporting

Using Subreports and Multi-Pass Reporting

Using Formulas and Custom Functions

Designing Effective Report Templates

Additional Data Sources for Crystal Reports

Multidimensional Reporting Against OLAP Data with Crystal Reports

Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design

Introduction to Crystal Repository

Crystal Reports Semantic Layer Business Views

Creating Crystal Analysis Reports

Advanced Crystal Analysis Report Design

Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting

Part V. Web Report Distribution Using Crystal Enterprise

Introduction to Crystal Enterprise

Using Crystal Enterprise with Web Desktop

Crystal Enterprise Architecture

Planning Considerations When Deploying Crystal Enterprise

Deploying Crystal Enterprise in a Complex Network Environment

Administering and Configuring Crystal Enterprise

Part VI. Customized Report Distribution Using Crystal Reports Components

Java Reporting Components

Crystal Reports .NET Components

COM Reporting Components

Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition

Introduction to Crystal Enterprise Embedded Edition

Crystal Enterprise Viewing Reports

Crystal Enterprise Embedded Report Modification and Creation

Part VIII. Customized Report Distribution Using Crystal Enterprise Professional

Introduction to the Crystal Enterprise Professional Object Model

Creating Enterprise Reports Applications with Crystal Enterprise Part I

Creating Enterprise Reporting Applications with Crystal Enterprise Part II

Appendix A. Using Sql Queries In Crystal Reports

Creating Enterprise Reporting Applications with Crystal Enterprise Part II



Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net