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

Problem with Conditional Group Total

edited April 2008 in End User
Using Report Builder 9 and delphi 7

Following the example in the report builder Fundamentals on conditional
group totals that seems to work when there is only 1 detail line if there is
more that 1 detail line that satisfies it skips the 1st detail line. Its
like the reset is occurring after the first sum is added. Any ideas on what
I am missing?


TIA

Dennis McGuire

Comments

  • edited May 2008
    Hi Dennis,

    I'm not clear which demo you are talking about. Have you tried downloading
    a trial copy of the latest version of ReportBuilder and testing with that?
    Take a look at the following article on how to make calculations in
    ReportBuilder.

    ----------------------------------------------------------------------
    TECH TIP: Performing Calculations
    ----------------------------------------------------------------------

    Calculations can be done either on the data access side
    or within ReportBuilder.

    When designing reports there are always decisions to be made as to
    how much processing to do on the data side versus the report side.
    Usually doing more on one side can greatly simplify the other. So it is
    often a personal choice based on the power and flexibility of the data
    and report tools being used.


    DataAccess
    ----------

    a. Use SQL - using SQL you can perform many common calculations:

    example: Select FirstName + ' ' + LastName As FullName,
    Quantity * Price AS Cost,


    b. Delphi TDataSets enable you to create a calculated TField object
    and use the DataSet.OnCalcFields event

    c. Perform any amount of data processing, summarizing, massaging
    etc. to build a result set (query or temp table) to feed to the report.


    ReportBuilder
    -------------

    Calculations in ReportBuilder are performed primarily using the TppVariable
    component.

    a. Set the Variable.DataType

    b. Code the calculations using the Variable.OnCalc event.

    c. Use the Timing dialog to control the timing of the OnCalc event. To
    access the Timing dialog, right click over the Variable component and select
    the Timing... option from the speed menu.

    d. Set the LookAhead property to True, when you need to display summary
    calculations in the title, header, group header, etc.

    e. To perform calculations based on the results of other calculations use
    the Calc Order dialog of the band. To access the Calc Order dialog, right
    click over the Band component and select the Calc Order... option from the
    speed menu.


    By using TppVariable components ReportBuilder will take care of caching
    intermediate results of accumlated calcs that cross pages.

    There are a number of calculation examples in the main demos.dpr project.

    ---

    Additional Notes:

    1. Do NOT use Band.BeforePrint or Band.AfterPrint. These events fire
    multiple times and therefore should not be used for calculations.

    2. Do NOT store results in variables that exist outside of the reports. For
    example - form level variables.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2008
    To show the problem im having I used a sample from your learn reportbuilder
    rap. You will notice that I am conditioning on order number>1000 and the sub
    totals do not add up correctly. if you use attached rtm file in learn rap
    you will see the problem






  • edited May 2008
    Hi Dennis,

    For future reference, please send all attachments to
    support@digital-metaphors.com.

    I am unfortunately unable to run your template because it uses DBISAM tables
    that I do not have. I did notice however that you have the variable set to
    calculate on DataPipelineTraversal. If you take a look at the demo you were
    using as a guide, this needs to be set to be set to Traversal to use the
    current report pipeline. DataPipelineTraversal is only to be used with a
    separate pipeline that may get traversed manually.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2008
    I changed it to traversal and it made no difference. I am obviously doing
    something wrong but I sure have not been able to figure it out. Any help
    would be appreciated .You ought to be able to run it if you download your
    Rap Tutorial



  • edited May 2008
    Hi Dennis,

    Thanks, I was able to see the problem. This seems to be a timing issue.
    Try setting your variable to reset on Group End rather than Group Start. It
    seems Group Start is occuring too late to include the first value.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2008
    Thanks that fixed it - you might want to correct your developers guide.
    Really appreciate it!!


This discussion has been closed.