HELP!
I'm trying to debug a report based on a master-detail relationship. The
report has a ppDBCalc component (with DBCalcType set to dcSum) attached
to a field in the master dataset. We want it to sum this field for each
record in the master dataset, but instead it sums for each record in the
DETAIL dataset. For a given master record: no detail records, the term
is zero; one detail record, the term is the master record's field value;
two detail records, the term is twice the master record's field value;
three detail records, the term is three times the master record's field
value; and so forth. We want a sum of the field's values, not a sum of
MULTIPLES of the field's values. By some peculiarity of chance, this
problem escaped attention for a long time. The customer who detected it
is looking at us askance . . . .
Is this a common problem? Is there an easy fix? Bear with me--I'm not
the programmer that works on my company's reports, and my knowledge of
these components is pretty rudimentary: you might say the pilot is
incapacitated and a flight attendant has been recruited to land the
plane. A little help?
Marc Benedict
Columbus systems
report has a ppDBCalc component (with DBCalcType set to dcSum) attached
to a field in the master dataset. We want it to sum this field for each
record in the master dataset, but instead it sums for each record in the
DETAIL dataset. For a given master record: no detail records, the term
is zero; one detail record, the term is the master record's field value;
two detail records, the term is twice the master record's field value;
three detail records, the term is three times the master record's field
value; and so forth. We want a sum of the field's values, not a sum of
MULTIPLES of the field's values. By some peculiarity of chance, this
problem escaped attention for a long time. The customer who detected it
is looking at us askance . . . .
Is this a common problem? Is there an easy fix? Bear with me--I'm not
the programmer that works on my company's reports, and my knowledge of
these components is pretty rudimentary: you might say the pilot is
incapacitated and a flight attendant has been recruited to land the
plane. A little help?
Marc Benedict
Columbus systems
This discussion has been closed.
Comments
Not to worry, we'll get this figured out . I just need a little more
information on how your report and data is set up.
1. Where is the DBCalc component located? Are you using a group inside the
main report, and if so, what field are you grouping on?
2. How exactly does your report look when it is printed. Do you traverse
all the detail data in a child subreport? How is this formatted?
3. You say you have the dbCalc component attached to a "Master" field, yet
you want to display a sum for each "Master" record. This would by
definition simply return the master field value. If you are creating a
running total, you may need to use a TppVariable rather than a dbCalc.
4. Finally, which versions of ReportBuilder/Delphi are you currently using?
--
Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
Delphi Informant Readers Choice awards!
http://www.delphizine.com/ballot2004/
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
1. The DBCalc is located in a summary band. The report uses several
groups. Group[0] is on InvDate, [1] on InvoiceNo, and [2] on
InvoiceKey, all fields from the same data pipeline as Subtotal, the
field on which the DBCalc in question is based.
2. As far as how it looks, a picture is worth a thousand words, but I
don't know about attaching an image for it. As far as I can tell, there
is no child subreport.
3. M.G. (who designed the report) intended for the DBCalc to produce
the sum, for each record, of the Subtotal field (like "select
sum(Subtotal) from Invoices"). You might say the desired result is the
final value of the running total. I looked into the TppVariable
component yesterday, tested it with apparent success this morning, and--
if the DBCalc component doesn't produce--will likely use it for the
workaround. I wouldn't mind knowing why the DBCalc won't do the trick,
though--we have a lot of them in place (I hope this isn't the tip of an
iceberg).
4. RB 7.02; Delphi 5 Update Pack 1.
Thanks,
Marcus
Thanks for all the information. The thing about the TppDBCalc component is
that it is not very smart. They are good for calculating simple sums across
a single group in the group footer or in the summary band with no groups or
subreports. Once you start to use them to calculate running totals across
numerous group breaks or numerous groups for that matter, their logic simply
cannot keep up with the literally thousands of report design options.
This is one of the reasons we have the TppVariable component. It gives you
full control on how you would like to make calculations inside your report
by allowing you to define the time of calculation, order of calculation, and
customize the actual calculation itself. Unfortunately, if you are making
numerous running totals with DBCalc components across groups or subreports,
they also may need to be replaced.
--
Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
Delphi Informant Readers Choice awards!
http://www.delphizine.com/ballot2004/
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com