Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Detail Variable on the Master

edited January 2005 in End User
Hello,

I have a problem with a Super Total.

My Report is based on a Master and a Detail, and I need to print a total in
the main page, but the total is the sum of a detail-field.

If I use the DBCalc component, rightly, I have no effect on the total.(I get
the first detail record value, but I know It's right)

If I use a Variable component, I have the problem in the example: the sum of
the detail-field for a master is the right sum (the sum of all detail-field
values for that master) plus the value of the first record.

Is it a bug of Variable component? I need a new way to solve my problem, and
this _must_ work totally from the end-user solution (no delphi code). Can
you help me?



Thank you in advance,
Cristian



To reply please remove _leavethis_ from my E-Mail address.

Comments

  • edited January 2005
    I apologize, but I forgot the versions
    - Delphi6 Updatepack2
    - Reportbuilder 7.03

    Thank you.

    "Cc" ha scritto nel messaggio
  • edited January 2005

    1. Summary Query

    If you do not want to use any code at all then I recommend creating a
    summary query that perform the sum using SQL.

    2. RAP Code

    If you are using RB Enterprise Edition, then another alternative is to use
    RAP code. You need to 2 TppVariable components. Place varMain in the main
    report and place varDetail in the subreport, you can set its Visible
    property to False. Then implement the varDetail.OnCalc like this:

    varMain.Value := varMain.Value + plDetail['myFieldName'];



    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2005
    Hi,

    I made as you told me and often it works, but not in every context:
    sometimes I build reports with this structure:

    GROUP

    Master

    GROUP

    Detail xxx

    GROUP

    Detail

    Total xxx

    In this context with your solution, if I set the KeepTogether flag I get
    wrong values; it seems it calcs some record two times.



    In the attachment you can find my example.



    Thank you in advance,
    Cristian





  • edited January 2005

    It is against newsgroup guidelines to post attachments. Please send
    attachments to support@digital-metaphors.com. TIA

    I did look at the example. KeepTogether Groups require a different approach.
    I was able to modify it to work. I configured Variable1 to reset on
    ReportEnd and code Variable1.OnCalc

    Value := Value + plOrders['OrderNo'];

    Then I used the GoupFooter.AfterPrint event to transfer the total to the
    variable in the maine report.

    fTotal_OrderNo.Value := Variable1.Value;





    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2005
    Oh Thank you,
    It works, but I see that in situations like this (It's normal) I must know
    the detailed ReportBuilder behaviours.
    The ufficial documentation doesn't contain such details. Where can I find a
    more detailed and technical documentation?

    Thank you,
    Cristian



This discussion has been closed.