Removing Band after loading report issue
Hello
I'm migrating some reports from FR2 to FR4 (4.15)
I've a report where the user can select 0 - 3 sums who are generated by frxGroupHeader bands. I've placed 3 of this bands in the report. After loadings the report I will delete the bands who I not need. I do this depending on that I've no condition for the group header than and this runs on an error. Even if the band is invisible. With FR2 and an invisible band it was not processed, with FR4 it will be (looks like).
My solution/ idea is to remove the not needed group header band by delphi code directly after loading the report's fr3 file.
procedure TfrmLstAuswStatistik.RemoveBand(BandName: string);
var
band: TfrxBand;
begin
band := frReport.FindComponent(BandName) as TfrxBand;
if (band <> nil) then
frReport.RemoveComponent(band);
end;
I call the function above for each of the not needed group header bands. In debuger I can see then the the band is found and the remove is called. No excpetion happens.
When the report will be shown I get the same exception about incorrect condition in the group header band
I debuged at frxReport.OnBeforePrint and I can see in debugger that the event is also called where Senders are my removed group header bands.
Showing the report (and fireing OnBeforePrint) is defintly called after I removed the bands.
Waht I'm doing wrong ? Is there an issue in FR 4.15 ?
I solved my condition problem by setting the conditions by default from blank to a dummy condition, but I want know if there is an issue or I'm my solution is generaly wrong.
regards
Stefan
I'm migrating some reports from FR2 to FR4 (4.15)
I've a report where the user can select 0 - 3 sums who are generated by frxGroupHeader bands. I've placed 3 of this bands in the report. After loadings the report I will delete the bands who I not need. I do this depending on that I've no condition for the group header than and this runs on an error. Even if the band is invisible. With FR2 and an invisible band it was not processed, with FR4 it will be (looks like).
My solution/ idea is to remove the not needed group header band by delphi code directly after loading the report's fr3 file.
procedure TfrmLstAuswStatistik.RemoveBand(BandName: string);
var
band: TfrxBand;
begin
band := frReport.FindComponent(BandName) as TfrxBand;
if (band <> nil) then
frReport.RemoveComponent(band);
end;
I call the function above for each of the not needed group header bands. In debuger I can see then the the band is found and the remove is called. No excpetion happens.
When the report will be shown I get the same exception about incorrect condition in the group header band
I debuged at frxReport.OnBeforePrint and I can see in debugger that the event is also called where Senders are my removed group header bands.
Showing the report (and fireing OnBeforePrint) is defintly called after I removed the bands.
Waht I'm doing wrong ? Is there an issue in FR 4.15 ?
I solved my condition problem by setting the conditions by default from blank to a dummy condition, but I want know if there is an issue or I'm my solution is generaly wrong.
regards
Stefan
Comments
generally just hide the bands by setting a variable check the variable in the obp event of the band you want to hide.
or use multi design pages and determine which page you want to process/view.