Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Records duplicated on subreport Post Reply Post New Topic
Author Message
wleonard
Newbie
Newbie


Joined: 08 Jun 2016
Online Status: Offline
Posts: 2
Quote wleonard Replybullet Topic: Records duplicated on subreport
    Posted: 14 Jun 2016 at 10:13am
I am new to Crystal Reports, and am attempting to fix a report that was started by the vendor of the
application where the report is run from, and I've identified 2 problem areas:
1. The report isn't grouping data in the subreport correctly (records are duplicated),
2. the running total for the groups contained in the subreport isn't summing correctly.

The report doesn't use any stored procedures, and the data consists of information regarding purchase
orders. The report displays the purchase order record and associated purchase order detail records (line
items). The main report displays "common" information for the purchase order record, and the subreport
displays detail information (line items) for the purchase order, and is supposed to be grouped by part
number, date, and then cost (of the part).

The subreport is placed in a GF. The layout of the main report:
RH - suppressed
PHa-PHb, GH1a-GH1h - record information
GH2 - Suppressed, with formula to create item numbers representing groups
GF2a-GF2d - record detail information, formula fields, including a running total from the subreport
GF2e - subreport containing additional record detail
GF2g - formula field

The layout of the subreport:
RH - suppressed
GH1 - group header
Details - data
GF1 - suppressed
RF - suppressed

The first issue that I was able to identify is that the running total is incorrect, and has been
placed above the subreport. I've read that because Crystal processes information in a linear fashion, a
running total won't work where it's been placed (above the subreport). Is this correct? As it is,
only the first record in the group is being processed. I used a shared variable, but this also presented
a problem with the first record's sum being skipped and subsequent summed values (even though summed
correctly) placed in the next/subsequent record. Given that most people believe that it's not possible
to use a running total placed above the subreport whose values are summed, I haven't moved forward with
troubleshooting until someone states that this can be done.

I don't understand why some records are being duplicated on the subreport, I'm sure because I'm having
trouble understanding how the groups are grouped as they currently are. I changed the group on the
subreport to group by part because it seemed more intuitively correct (initially the subreport was set
to group by purchase order line ID), but the duplication of records still exists. I also eliminated some
of the existing subreport links that appeared to be redundant (for lack of a better term), but this also
made no impact on the subreport data.

I've included a link to 2 pics: 1 to illustrate the problem, the other to show the desired result. The shaded rows are heading rows, and the second level heading rows should repeat for each group. The red lines
illustrate the duplication.

https://goo.gl/photos/wEqBv7bByZFPRjBP7

FWIW, by suppressing the second level group header, the duplication of records ceases.

If you would provide any input, I'd appreciate it.
Thank you.
Matt
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jun 2016 at 2:50am
Running totals (RT) do not function "correctly" in headers. They will only show results as of the first dta row below that header. That said I am unclear how the RT is functioning at all in the main report. Sub reports do not move data to the main report unless via a shared variable (which also must be placed below/after the sub report).
Also do not confuse hiding duplicate data with removing duplicate data. Just because it is hidden via grouping or suppression does not mean it was excluded so any evaluations done will still include those rows, unless you exclude them via a formula in the RT or the variable formulas.

Edited by DBlank - 15 Jun 2016 at 2:50am
IP IP Logged
wleonard
Newbie
Newbie


Joined: 08 Jun 2016
Online Status: Offline
Posts: 2
Quote wleonard Replybullet Posted: 15 Jun 2016 at 3:48am
DBlank-
Thanks for the explanation on running totals, and confirmation of placement. It's probable that during my testing with the running total field on the main report that the field was in a GF. I never should have included that statement without more detail. Sorry for the confusion.

Point taken on suppressing vs. excluding data. That is good stuff.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.