1 (edited by prahousefamily 2019-01-28 10:03:05)

Topic: Get Bug Report Script ! Summary In Group Header

Printing a group sum in the group header
https://www.fast-report.com/documentati … header.htm
But Get Error  summary miss  group



Summary Group Header  Group(1)      To  Group(2)
....
Summary Group Header  Group(Last) To  Group(1)

procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
    Set('S', Sum(<Report."population">));  
end;

procedure Memo5OnBeforePrint(Sender: TfrxComponent);
begin
    if Engine.FinalPass then
    Memo5.Text := FormatFloat('0,000',Get('S'));  
end;

begin

end.

https://i.ibb.co/QX8ZdNb/2019-01-28-006.png

Post's attachments

Attachment icon world.zip 408.6 kb, 481 downloads since 2019-01-28 

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: Get Bug Report Script ! Summary In Group Header

Unfortunately I don't know why it does not work, please use another method

var
  List: TStringList;
  i: Integer;  


procedure GroupHeader1OnBeforePrint(Sender: TfrxComponent);
begin
  if Engine.FinalPass then 
       if ValidInt(List[i]) then 
               Memo5.Text := FormatFloat('#,##0', StrToFloat(List[i]));

end;              
  
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
  if not Engine.FinalPass then List.Add(FloatToStr(SUM(<Report."population">, MasterData1)));              
  Inc(i);                                  
end;


procedure frxReportOnStartReport(Sender: TfrxComponent);
begin
  List := TStringList.Create;
end;

procedure frxReportOnStopReport(Sender: TfrxComponent);
begin
  List.Free;                                      
end;

procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
  i := 0;  
end;
Dmitry.

3 (edited by prahousefamily 2019-01-31 04:14:20)

Re: Get Bug Report Script ! Summary In Group Header

Thank You  Dmitry.
For Fix  Error And Easy  use Stringlist in this problem

For MVD Community  can download "bug_report.fr3"  replace original Fix Error
https://i.ibb.co/tcNT1Bm/2019-01-31-005.png
https://i.ibb.co/MR58CqZ/2019-01-31-006.png
Script Fix

var
//sum
sList: TStringList;
si: Integer;
//count
cList: TStringList;
ci: Integer;
//max
xList: TStringList;
xi: Integer;
//min
yList: TStringList;
yi: Integer;
procedure GroupHeader1OnBeforePrint(Sender: TfrxComponent);
begin
    if Engine.FinalPass then
    if ValidInt(sList[si]) then
    Memo5.Text := 'SUM = '+FormatFloat('#,##0', StrToFloat(sList[si]));
    if Engine.FinalPass then
    if ValidInt(cList[ci]) then
    Memo10.Text := 'COUNT = '+(cList[ci]);
    if Engine.FinalPass then
    if ValidInt(xList[xi]) then
    Memo4.Text := 'MIN = '+FormatFloat('#,##0', StrToFloat(xList[xi]));
    if Engine.FinalPass then
    if ValidInt(yList[yi]) then
    Memo11.Text := 'MAX = '+FormatFloat('#,##0', StrToFloat(yList[yi]));
end;
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
    if not Engine.FinalPass then sList.Add(FloatToStr(SUM(<Report."population">, MasterData1)));
    Inc(si);
    if not Engine.FinalPass then cList.Add(FloatToStr(count(masterdata1)));
    Inc(ci);
    if not Engine.FinalPass then xList.Add(FloatToStr(MIN(<Report."population">,MasterData1)));
    Inc(xi);
    if not Engine.FinalPass then yList.Add(FloatToStr(MAX(<Report."population">,MasterData1)));
    Inc(yi);
end;
procedure frxReportOnStartReport(Sender: TfrxComponent);
begin
    sList := TStringList.Create;
    cList := TStringList.Create;
    xList := TStringList.Create;
    yList := TStringList.Create;
end;
procedure frxReportOnStopReport(Sender: TfrxComponent);
begin
    sList.Free;
    cList.Free;
    xList.Free;
    yList.Free;
end;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
    si := 0;
    ci := 0;
    xi := 0;
    yi := 0;
end;
begin
end.
Post's attachments

Attachment icon bug_report.fr3 10.48 kb, 523 downloads since 2019-01-31 

My Visual Database : I Love You
Easy For Beginner Student For Me