0

I've looked throughout multiple guides, but none seem to give good guidelines as to when to put items into Group Header vs Details vs Group Footer.

Generally, my understanding is to put totals of any kind into the appropriate level group footer, as the header runs first -> details -> footer.

I'm really confused, as I had to set up a more complex report recently. I've got three tables - a "job master", "billings master (connected by job number)", and "costings master (connected by job number)". I set up a group for the "job master" job numbers, and tried to pull billings and costings from each of the other tables. However, no matter where I put the information (group header, details, or group footer) some of it comes out wrong.

We needed the report asap, so I ended up making one subreport for the billings, and another subreport for the costings, and used universal variables to pull things out of the subreport. This is not efficient and has a very long runtime, but the data is right. I put the subreports in the footer.

I'm sure there's probably a smarter way to do this, but it seems I don't really understand how to use header/footer/details sections when you have fields from multiple databases to pull from. Anyone have any pointers? Thanks!

Jonne Haß
  • 4,792
  • 18
  • 30
KHao
  • 5
  • 3

1 Answers1

0

Your question is kind of too broad. If you report a specific case, i am sure you will get more help.

But what i can say for now, your probably already figured out by your self:

  1. Details section show iterative data.
  2. Header and footer shows non-iterative data (except, someway, group header and group footer).

If you play with "running total fields" in those sections and compare them with "summary fields", you will notice important stuff. I believe you are confused because you were expected the behavior of "running total fields" where you did use "summary fields", but i am just speculating.

I do not know how Crystal Reports is implemented, but here is my mental model that helps me to understand what is going on in the sections.

  1. Suppose you have a report with two tables and you have no subreports.
  2. First, Crystal will join your tables. The join will be accordingly to how you set the links between the tables. If you do not set up the links correctly, you will end up with a cartesian product of the tables, wich probably means undesired repeated rows.
  3. The result of this join is a "projection" with N rows. So, for each row, it will print a "details" section.
  4. So, if you put one field (a column actually) of the table in the details section, you will see the values beeing printed like you probably expect.
  5. But if you put the same field in the page header, it will print the first occurrence.
  6. But if you put the same field in the page footer, it will print the last occurrence (not sure if it is the last).
  7. Summary fields will be computed after the iteration over the rows. It means that it does not matter if they are on the header or in the footer - the result is the same. So, if there are 10 rows for the details section where a column has the value 1 for all the rows, and you create a summary field to sum up this column, its result will be 10 in both sections (header and footer).
  8. Running total fields will be computed on the fly. So, if there are 10 rows for the details section where a column has the value 1 for all the rows, and you create a running total field to sum up this column, the result will be 0 in the header, 10 in the footer, and if you put this running total field in the details section, it will show the accumulated value up to that row (1, 2, 3, ..., 9, 10).
  9. You can think analogously for groups headers and footers.
heringer
  • 2,698
  • 1
  • 20
  • 33