How to hide page in Fast Report if there are no data on page?

10k Views Asked by At

I'm desiging a fast report with two pages,on the 2nd page i'have used Page header/footer,group header/footer and master data band. I have to hide the page2 if there is no data in master data band.name of master date band is 'masterdata2'. the pascal script i'm trying to use

procedure Page2OnAfterPrint(Sender: TfrxComponent);
begin
          if MasterData2.RowCount <> 0 then                                                                      
              Page2.visible :=true
              else
               Page2.visible :=false;                                              

end;

but its not hiding the page to print if there is no data on page 2.Any help??

1

There are 1 best solutions below

0
On

if you try it:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyPage: TfrxPage;
begin
  if ADOQuery1.RecordCount > 0 then
  begin
    MyPage := frxReport1.FindComponent('Page1') as TfrxPage;
    MyPage.Visible := False;
  end;
  frxReport1.ShowReport;
end;

For more informations find for "FR4.6.ProgrammerManual-en.pdf" in Google.