Search code examples
crystal-reportscrystal-reports-2016

Crystal Reports 2016 - How to display multiple tables?


I am actually stuck with a multiple tables problem. I want to display 2 tables in my report. I saw how to do it with C# but I am not using C#, only Crystal Reports. So I have to manage to do it inside Crystal Reports. Is there any way to do it other than use 2 sub reports?

Because from what I understood (I am very new to Crystal reports): to make a table, you have to put the header of the columns in a Header section and the datafields in a Details section. But when you create sub groups, you can't add Details sections to each group, right?

What I want is something like that:

Example of what I need

How should I organize my report (in the section expert) to manage such a thing?

Thank you very much to anyone that can help!


Solution

  • You may be overthinking the details sections. When you group data in Crystal Report you get a Header and Footer section for each grouping level. So if you have 3 grouping levels, the report has the following sections.

    Report Header
    Page Header
    Header 1
      Header 2
        Header 3
          Details
        Footer 3
      Footer 2
    Footer 1
    Report Footer
    Page Footer
    

    In this report layout the details section contains detail records for Header 3 data. The data for Header 1 is detailed in Header 2, and the detail for Header 2 is found in Header 3.

    The table layout you want to use is probably going to require at least 1 subreport. You may be able to pull the data for the first table along with the report data that is a higher level than tables, but you may need to do 2 subreports to prevent duplication of the data. I would focus on getting each table working in individual reports first, then you can link them into another report as subreports once you have both tables displaying the way you would like.