set variable to memo in double pass group footer
Hello to all,
Why does the memo field in the group footer equal to the last value of a variable I am using as a accumulating.
Sample: script
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass=false then begin
lhrs:=lhrs+<adoquery1."QTY">;
end;
end;
procedure GroupFooter2OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass=false then begin
memo1.text:=formatfloat('#.00',lhrs);
end;
The memo field is set to the last value lhrs is for all groupfooter breaks.
It should be a different value for each grouped item.
Can anyone elaborate.
Why does the memo field in the group footer equal to the last value of a variable I am using as a accumulating.
Sample: script
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass=false then begin
lhrs:=lhrs+<adoquery1."QTY">;
end;
end;
procedure GroupFooter2OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass=false then begin
memo1.text:=formatfloat('#.00',lhrs);
end;
The memo field is set to the last value lhrs is for all groupfooter breaks.
It should be a different value for each grouped item.
Can anyone elaborate.
Comments
var
lhrs: integer
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
lhrs:=lhrs+<adoquery1."QTY">;
end;
begin
lhrs:=0; {could initilize here}
end.
YOU MUST reinitialize its value to 0 in the correct group header.
then all you need to do is to have [lhrs] in the memo and set its display format
no need for code in the footer.
Code:
Logic problem was changed to fill memo fields on second pass.