Adding a summary to an exisiting report
I have inherited a program that uses multiple report engines, 'ugh'. But my
question involves adding a summary to just one of them.
I am using the ppSummaryBand1BeforeGenerate to run a procedure that
populates a Memo box as such:
procedure TForm_StudyReport.ppSummaryBand1BeforeGenerate(Sender: TObject);
begin
PopulateLegend;
end;
procedure TForm_StudyReport.PopulateLegend;
var
IntList :variant;
begin
IntList := FPerslIDAccum.CommaText;
If IntList <> '' then
Begin
ppLegendTitle.Visible := true;
ppLegend.visible := true;
with QueryX do
Begin
SQL.Add('select LAST_NAME, FIRST_NAME, INITIALS ');
SQL.Add('from personnel ');
SQL.Add('where Personnel_id in ('+IntList+')');
Open;
While not Eof do
begin
ppLegend.Lines.Add(Fields[2].AsString +#9+
Fields[0].AsString +', '+ Fields[1].AsString );
Next;
end;
Close;
SQL.Clear;
End; //with
End;
end;
The TStringlist is a Sorted, IgnoreDup list.
My problem is that the event ppSummaryBand1BeforeGenerate seems to be firing
for every element in the Detail section!? The Help states that this is just
to happen once per report with one summary band. Can you help me.
I have recently upgraded from 5.54 to 6.0
TIA
question involves adding a summary to just one of them.
I am using the ppSummaryBand1BeforeGenerate to run a procedure that
populates a Memo box as such:
procedure TForm_StudyReport.ppSummaryBand1BeforeGenerate(Sender: TObject);
begin
PopulateLegend;
end;
procedure TForm_StudyReport.PopulateLegend;
var
IntList :variant;
begin
IntList := FPerslIDAccum.CommaText;
If IntList <> '' then
Begin
ppLegendTitle.Visible := true;
ppLegend.visible := true;
with QueryX do
Begin
SQL.Add('select LAST_NAME, FIRST_NAME, INITIALS ');
SQL.Add('from personnel ');
SQL.Add('where Personnel_id in ('+IntList+')');
Open;
While not Eof do
begin
ppLegend.Lines.Add(Fields[2].AsString +#9+
Fields[0].AsString +', '+ Fields[1].AsString );
Next;
end;
Close;
SQL.Clear;
End; //with
End;
end;
The TStringlist is a Sorted, IgnoreDup list.
My problem is that the event ppSummaryBand1BeforeGenerate seems to be firing
for every element in the Detail section!? The Help states that this is just
to happen once per report with one summary band. Can you help me.
I have recently upgraded from 5.54 to 6.0
TIA
This discussion has been closed.
Comments
For future reference, we prefer that you use your real name when asking
questions on this newsgroup.
It is never a good idea to manipulate data during report generation. This
is not what the Report Engine was designed to handle. I would recommend
creating another dataset outside the report using the SQL you mentioned in
your previous post. Then place a TppSubreport inside the summary band and
connect it to your new dataset. The subreport will then traverse your data
automatically without the need for a while loop, or any other code.
If you are planning on spending some time with ReportBuilder, I would also
recommend going over the ReportBuilder Developer's guide when you get a
chance. This is an excellent resource and tutorial that enables a user to
hit the ground running when starting developing with ReportBuilder. A copy
of the Developer's guide can be found in your \RBuilder\Developer's
Guide\... directory.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com