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

Report Summary - Variable Calc Not Correct Running.

edited November 2006 in General


Summary Content;

2 db Calc.
and
1 Variable

I wan't Variable Value = DbCalc1 / DbCalc2 But not running.

Please Test it on the Basic Report.

I running Script on the Variable1.OnCalc.

Please Help.
Urgent FeedBack.

My Customer is waiting.

But your script not correct running.

Nezir Ogur

Comments

  • edited November 2006
    Nezir,

    Where are you making your calculation? When making calculations inside a
    report, it is always best to strictly use the OnCalc event of a TppVariable.
    It is also not recommended that you use DBCalc components in a calculation
    as the timing of these components differs drasticly from TppVariables. I
    would recommend replacing the DBCalc components with TppVariables and
    performing their calculations manually in their OnCalc events. Then inside
    the third TppVariable's OnCalc, make the calculation you have below.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006

    Hello Nico,

    I making calculation on the summary block.

    And Summary Block have got 2 DbCalc Field.

    And I'm writed DbCalc1 / DbCalc2 on the Variable1 OnCalc Event.

    But DbCalc1 / DbCalc2 result value is wrong.

    Please test it basic report on the sample application.

    Best Regards.
    Nezir Ogur
  • edited November 2006
    Hi Nezir,

    Which event are you making the calculation? My guess would be that if you
    trace into your code and see the value of each DBCalc component, the value
    will not be fully calculated yet. The DBCalc components are working as
    designed and are not meant to be used in other calculations. This is why it
    is best to only use TppVariables when making calculations on your report.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    >



  • edited November 2006
    Which event are you making the calculation? The DBCalc components are
    working as designed and are not meant to be used in other calculations.
    This is why it is best to only use TppVariables when making calculations on
    your report.

    ----------------------------------------------------------------------
    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 November 2006
    Hi Nico,

    I changed your sample for error.

    Please look report last page on the sample.

    Please Look under 'Look at this value' string.

    Variable4 = 0



    Best Regards.

    I'm waiting your answer.



  • edited November 2006
    Hi Ferruh,

    Please send all attachments to support@digital-metaphors.com.

    If possible re-send the example in .zip format to us (via email) and I'll
    take a look at it for you.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.