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

variables on break groups

edited August 2002 in General
Hi,
I have this problem:
My report must show several total fields for a selected year for various
groups.
In addition for every group, below every total field, there must be the
corresponding total for the previous year.
I solved this by running a query for the previous year, collecting the
needed
totals in a list of arrays (every cell corresponds to a needed total), and
then running the report
on the data generated by query for the current year. In every group footer I
placed variables below the DBCalcs that compute totals for the group. I
set the variables CalcType to veGroupEnd and the CalcComponent to the group.
I don't need reset so I don't set the ResetType or ResetComponent. I don't
care if the variables are reset for every record as in the group end they
are set to the values to print - and printed. By the way with this settings
the OnReset event is never triggered!
In the OnCalc event of the variables I set the Value to a value from the
list I made earlier for the prev year.
All event handlers code is executed only for the SECOND pass of the report
using "if not report.firstpass" (It's possible to 'calc' the values only
once - and setting the calc values in the second pass makes them appear in
print).
The result of this is:
The first group footer displays zeros for all variables, the second displays
the calculated values of the first group, any group after displays the
calculated fields of the previous group.
In addition if the group footer appears on the top of a page the values are
also zero.
I can't figure where the zeroes are coming from (especially for the pages
2..n).
In order to check that I coded the ResetType=veGroupEnd,
ResetComponent=group. In the OnReset event I reset the variables to 15. I
expected to see 15 instead of 0 in the problem group footers but the 0
remained! (I realy didn't expect to see 15. in my opinion the values are
reset and assigned values by my OnCalc so the reset values do not appear at
all).

1. Can any one suggest what is happening?
2. Is there any other/better way to solve the problem of showing totals for
different data then the report data, in the same group footer?
3. Is there a document describing the exact order of events for every
possible scenario of report generating (or as many as possible) ?
maybe a tech tip. If any one has this info please write or point me to it.
(I know I can map that myself by setting every event handler and breaking -
please save me the work).

Thanks in advance
Israel

Comments

  • edited August 2002
    If you are going to base a group on a variable, you need to use the
    OnGetText event of the variable to set its value. The reason is that the
    OnCalc timing doesn't fire by the time the group is determining its group
    break value. There is an event tracker demo which shows all of the events
    which are firing in the report. It is in the main report demo project of
    your installation.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.