formating numeric
I'd made some totals in group header, but the result show 12345.1234, I just need 12345.12, I'd tried to use format() function, but it prompt error. How to use the function?
Var List1,List2: TStringList;
    i: Integer;
procedure frxReport1OnStartReport(Sender: TfrxComponent);
begin
  List1:=TStringList.Create;
  List2:=TStringList.Create;                                                           Â
end;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
  i:=0;         Â
end;
procedure GroupHeader1OnBeforePrint(Sender: TfrxComponent);
begin
  if Engine.FinalPass then
  begin
    Memo34.Text := Format('%2.2n',[List1[i]]);  //won't work                       Â
    Memo36.Text := List2[i];                    //work, but without format                                                                                                               Â
  end;           Â
end;
   Â
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
  if not Engine.FinalPass then
  begin             Â
  List1.Add(SUM(<Query1."QTY">,MasterData1));
  List2.Add(SUM(<Query1."AMOUNT">,MasterData1));
  end;
  Inc(i);                 Â
end;
 Â
procedure frxReport1OnStopReport(Sender: TfrxComponent);
begin
  List1.Free;
  List2.Free;                         Â
end;
begin
                     Â
end.
Comments
but why go to all that trouble just set the display format property of the memo at design time.
select the memo rtclck select display format.
the display format property wont work as you are working with the final output string.
i see you incrementing the index in the group footer but i dont see the index(i) being reset anywhere
so you are probably on an empty value in the final pass, also dont forget that a tstringlist is a 0 based array of tstrings, so the first item added has an index value of 0.
you might also want to look at the main demo.
under dialogs and script "totals in group header" report, to see how we handled it as well as the user manual.
using a tstringlist.
Var List1,List2: TStringList;
idx: Integer;
procedure Band7OnBeforePrint(Sender: TfrxComponent);
begin
// Set(<Sales."Company">, Sum(<Sales."Qty">*<Sales."List Price">));
if not engine.finalpass then
begin
// format the value when adding the the string to the list.
list1.add(Format('%2.2m',[Sum(<Sales."Qty">*<Sales."List Price">,band6)]));
end;
end;
procedure Memo4OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass then
begin
// Memo4.Text := 'Sum: ' + Format('%2.2m',[Get(<Sales."Company">)]);
memo4.text:=List1[idx];
inc(idx);
end;
end;
begin
List1:=TStringList.Create;
idx := 0;
end.