create dynamic report problem

I try to create a dynamic report. I've declared a class for my fastreport in Delphi:

TF_Report = class
private
FReport : TfrxReport;

FDataPage: TfrxDataPage;
FPage: TfrxReportPage;
FTitleBand: TfrxBand;
FHeadBand :TfrxColumnHeader;
FDataBand: TfrxMasterData;
FFont: TFont;
FMemo: TfrxMemoView;
FHMemo: TfrxMemoView;
FDMemo: TfrxMemoView;
public
constructor Create(AOwner: TComponent);
destructor Destroy;
function CreateItems(dbsGrid: TADBGrid; Index: Integer): Integer;
procedure DestroyItems;
end;
var
FR_General: TF_Report;

here is the constructor method to create the fastreport object:

constructor TF_Report.Create(AOwner: TComponent);
begin
DM_Resource.frxDBDataset1.DataSet := Frm_Report_General.Report; //Report is a query
FReport := TFrxReport.Create(AOwner);
FReport.DataSets.Add(DM_Resource.frxDBDataSet1); //I've placed a frxDBDataset on my form
FDataPage := TfrxDataPage.Create(FReport);
FPage := TfrxReportPage.Create(FReport);
FPage.CreateUniqueName;
FPage.SetDefaults;
FPage.Orientation := poLandscape;

FTitleBand := TfrxReportTitle.Create(FPage);
FTitleBand.CreateUniqueName;
FTitleBand.Top := 16;
FTitleBand.Height := 60;

{ add an object to the report title band }
FMemo := TfrxMemoView.Create(FTitleBand);
FMemo.CreateUniqueName;
FMemo.Text := QuotedStr('Test');
FMemo.Height := 20;
FMemo.Align := baWidth;
{ add the masterdata band }
FHeadBand := TfrxColumnHeader.Create(FPage);
FHeadBand.CreateUniqueName;
FHeadBand.Top := 96;
FHeadBand.Height := 30;

FDataBand := TfrxMasterData.Create(FPage);
FDataBand.CreateUniqueName;
FDataBand.DataSet := DM_Resource.frxDBDataSet1;
FDataBand.Top := 184;
FDataBand.Height := 30;

fdMemo := TfrxMemoView.Create(fDataBand);
fdMemo.CreateUniqueName;
FDMemo.Text := QuotedStr('hi');
FReport.ShowReport();
end;

I can see the titleband with the memo but my databand is not created. please help me. tanx.

Comments

  • edited 2:43AM
    Databand only show when there is dataset attached and has at least 1 row.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.