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

Resetting tppVariables

edited January 2005 in General
Hi,

I've some problems resetting tppvariables when grouping on multiple fields.
I'm using 2 tppvariables to get running totals for each groupbreak that
occurs. I've tried setting ResetOn to veGroupStart,veGroupEnd but the values
on the report are wrong. When i use veGroupStart variables are reset too
late, first detailband value isn't added. When i use veGroupEnd variables
are reset too late, last detailband value previous group got added somehow.
Data is sorted well according to the groups. When i use tppdbCalc instead of
tppvariable components the running totals for each group is fine, but i need
to build in conditions so i can't use tppdbCalc components. Could u give me
some detailed info (CalcType,CalcComponent,ResetOn,ResetComponent) how to
setup tppvariables to get running totals per group.

Greetings,
Filip Moons

Timing tppvariable1 (Group1)
-CalcType: veDataPipelineTraversal
-CalcComponent: DataPipeline report
-ResetOn: veGroupEnd
-ResetComponent: Group1
-OnCalc: ppCalc

Timing tppvariable1 (Group2)
-CalcType: veDataPipelineTraversal
-CalcComponent: DataPipeline report
-ResetOn: veGroupEnd
-ResetComponent: Group2
-OnCalc: ppCalc

procedure TForm.ppCalc(Sender: TObject; var Value: Variant);
begin
if condition then
value := value + DataPipeline report['SOME_INTEGER_FIELD'];
end;

Situation: veGroupStart

Group1
Group2
Detail 1 10 < First detail didn't get added
somehow
Detail 2 20
Break group2 20
Detail 1 -5 < First detail didn't get added
somehow
Break group2 0
Break group1 20
Group1
Group2
Detail 1 10 < First detail didn't get added
somehow
Detail 2 20
Break group2 20
Detail 1 -5 < First detail didn't get added
somehow
Break group2 0

Situation: veGroupEnd

Group1
Group2
Detail 1 10
Detail 2 20
Break group2 30
Detail 1 -5
Break group2 -5
Break group1 25
Group1
Group2
Detail 1 10
Detail 2 20
Break group2 25 < Last detail previous break got added
somehow
Detail 1 -5
Break group2 -5
Break group1 20 < Last detail previous break got added
somehow

Comments

  • edited January 2005
    Hi Filip,

    I had some problems figuring out how to make TppVariables calculate
    "on-time". Here is how I did the trick:

    Group Header 1
    Group Header 2
    Detail
    ppDBField
    Group Footer 2
    ppVariable1.OnCalc : Value := Value + ppDBField.Value;
    ppVariable1 calculate on veTraversal and NOT veDataPipeLineTraversal
    ppVariable1 reset on veGroupEnd of Group 2
    Group Footer 1
    ppVariable2.OnCalc : Value := Value + ppVariable1.Value;
    ppVariable2 calculate on on veGroupBeforeFooter of Group 2
    ppVariable2 reset on veGroupEnd of Group 1

    Now, it should work.

    David Caouette
    Developer
    Omniciel International inc.
    http://www.omniciel.com

    "Filip Moons" a ?crit dans le message de
  • edited January 2005
    Thanks David, after changing to veTraversal my running totals are fine.

    Greetings,
    Filip

This discussion has been closed.