Creating subreport from code
Bruno de Chassey
Versailles, France
I'd like to build a report entirely by code.
So far, the subreport's creation resists... and I cannot find any sample code.
I tried this (and many other options) :
There is no exeption but the data is not fulfilled in the report.
Do you have any idea of what's going wrong?
So far, the subreport's creation resists... and I cannot find any sample code.
I tried this (and many other options) :
SubReport:= TfrxSubreport.Create(DataBand);
  SubReport.CreateUniqueName;
  SubReport.PrintOnParent:= true;
  SubReport.Top:= 0; // * fr1cm;
  SubReport.Height:= 2 * fr1cm;
  SubReport.Width:= 5 * fr1cm;
  SubReport.Visible:= true;
 Â
  SubReportPage:= TFrxReportPage.Create(SubReport);
  SubReportPage.CreateUniqueName;
  SubReportPage.SetDefaults;
  SubReport.Page:= SubReportPage;
  DataBand := TfrxMasterData.Create(SubReportPage);
  DataBand.CreateUniqueName;
  DataBand.DataSet := frxDBDataset2;
  DataBand.Height := 0.5 * fr1cm;
  Memo:= TfrxMemoView.Create(DataBand);
  Memo.CreateUniqueName;
  Memo.Height:= 0.5;
  Memo.Top:=0;
  Memo.AutoWidth:= true;
  Memo.DataSet:= frxDBDataset2;
  Memo.DataField:= 'LibStat';
There is no exeption but the data is not fulfilled in the report.
Do you have any idea of what's going wrong?
Comments
I didn't know that it was possible to save the created report.
Thanks a lot for telling me this :-)
This is a great way to debug it... and I discovered that one dataset hadn't been associated with the report.
This had nothing to do with the subreport itself!