Bug in Manual For Group Header

just For information

the example in FR4.0 PDF has a bug

var
List: TStringList;
i: Integer;
procedure frReport1OnStartReport(Sender: TfrxComponent);
begin
List := TStringList.Create;
end;
procedure frReport1OnStopReport(Sender: TfrxComponent);
begin
List.Free;
96 FastReport 4.0 User's Manual
?© 1998-2006 FastReports Inc.
end;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
i := 0;
end;
procedure GroupHeader1OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass then
Memo8.Text := 'Sum: ' + List;
end;
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
if not Engine.FinalPass then
// Its Wrong ...The Correct Is
// if Engine.FinalPass then
List.Add(FloatToStr(SUM(<Group."ItemsTotal">,MasterData1)));
Inc(i);
end;
begin
end.


A friendly Note : This way is much better for Show sum in Group header but dont forget Two pass Option

Comments

  • gpigpi
    edited 6:26AM
    if not Engine.FinalPass then
    
    This is correct code
  • edited 6:26AM
    gpi wrote: »
    if not Engine.FinalPass then
    
    This is correct code

    Look At the C code bellow in manual
  • gpigpi
    edited 6:26AM
    wrote:
    Look At the C code bellow in manual
    C code runs on first and second pass, but you need to run this code on first pass only
  • edited 6:26AM
    gpi wrote: »
    gpi wrote: »
    Look At the C code bellow in manual
    C code runs on first and second pass, but you need to run this code on first pass only

    Not dosnt work in my FR...i change it and it work now

    you can check it too
  • gpigpi
    edited 6:26AM
    See FRDemo "Dialogs and script" section "Totals in group header" report

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.