On Thu, 18 Mar 2021, Andreas Frieß via fpc-pascal wrote:

I have a sample attached to show the problem.

I want in the report (created a runtime) to use more than one report
datasource. I create a databand and connect this with a
TFPReportObjectListData object. Each TFPReportObjectListData object
works. But i want to have the data of the first, then the data of the
other object. But i am not able to combine this two Data in one Report.

*--------------------*
  DataBand := TFPReportDataBand.Create(p);
  DataBand.Name:= 'DBBand01';
  DataBand.Layout.Height := 10;
  DataBand.Data:= lReportOLData1;   // First Data !!!!! This is shown

  Memo := TFPReportMemo.Create(DataBand);
  Memo.Layout.Left := 5;
  Memo.Layout.Top := 0;
  Memo.Layout.Width := 60;
  Memo.Layout.Height := 5;
  Memo.Font.Name := defaultFont;
  Memo.Text := '[InfoA] - [ValueA]';


  DataBand2 := TFPReportDataBand.Create(p);
  DataBand2.Name:= 'DBBand02';
  DataBand2.Layout.Height := 10;
  DataBand2.Data:= lReportOLData2;   // Second Data !!!!! This is not shown

  Memo2 := TFPReportMemo.Create(DataBand2);
  Memo2.Layout.Left := 5;
  Memo2.Layout.Top := 0;
  Memo2.Layout.Width := 60;
  Memo2.Layout.Height := 5;
  Memo2.Font.Name := defaultFont;
  Memo2.Text := '[InfoB] - [ValueB]';

*--------------------------*
Any Hint for this problem to solve ?

This is not supported as you write it.

You can have multiple datasources, but only 1 data band. If you need multiple data bands, you'll need to use master-detail.

If you want to use the second dataset in a memo expression, you must add it
to the reportdatasets:

lReportOLData2.name:='Data2';
YourReport.ReportData.Add(lReportOLData2);

and in memo2 (which you must place somewhere else):

 Memo2.Text := '[Data2.InfoB] - [Data2.ValueB]';

I can't advise you on what bands you must place memo and how to advance the 2nd
data list, because for that I would need to know the expected layout.

By the way, in
 if Assigned(rptExporter) then FreeAndNil(rptExporter);
etc.

The If Assigned() is not needed. FreeAndNil (or more accurately, Free) will 
already check this for you.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to