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

Totaling Variables

edited April 2002 in General
Hi.
I have a report that is creating a list of people and how much they are due
to pay.
The report also includes a field for if they are on hold (this is indicated
by a start and end date)
If they are on hold they have an on hold amount.

Is there anyway I can create this in the pipeline data as a specific field?
A bit like an OnCalc field on a dataset and put the value in there?

Alternatively

I've tried created a variable called actual billing (cuurency) which is
calculated on each member by events running to check if its the on hold or
normal amount and this is appearing OK.
BUT
How can I get a total of this at the bottom of the groups / summary.

Comments

  • edited April 2002
    You can add this field at the data set (i.e. a table or a query). Right
    click on the data set component, select Fields Editor, right click again and
    add a new Field. After naming the field implement the OnCalcFields event of
    the data set to calculate a value for the field. For example:

    procedure TForm1.ADOTable1CalcFields(DataSet: TDataSet);
    begin
    DataSet.FieldByName('OnHold').AsBoolean := (aDate > StartDate) and (aDate
    < EndDate);
    end;

    If you are actually creating a variable you will have to manually sum it
    using a global report variable. To do that, in the variable's OnCalc event
    sum the currency value into the global sum after it has been calculate it.
    Then place another variable in the group footer/summary and in it's OnCalc
    event simply assign to it the value of the global. Watch your calculation
    carefully if the report is set to Two Pass to avoid doing double
    calculations. You can check which pass the report is on by accessing the
    FirstPass and SecondPass boolean properties of the report.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.