Load template and assign datasets in runtime
I have template RozpisObjednavekOdberatelu.fr3 (attachment).I loaded in code this template and assign datasets with this pieces of code:
Preview result is in RozpisObjednavekOdberatelu.jpg
Please help me with this.
procedure TTemplateReporter.Preview;
begin
  ReAssignDatasets;
  PrepareReport(False);
  ShowPreparedReport;
end;
procedure TTemplateReporter.ReAssignDatasets;
begin
  DatasetsDictionary.ForEach(
    procedure(const pDS:TPair<string,TDataset>)
    begin
      AssignDataset(pDS.Key,pDS.Value);
    end
  );
end;
procedure TTemplateReporter.AssignDataset(const pReportDSName: string; const
    pDataSet: TDataSet);
var
  lRDS: TfrxDBDataset;
begin
  lRDS:=FastRep.FindObject(pReportDSName) as TfrxDBDataset;
  if Assigned(lRDS) then
  begin
    lRDS.CloseDataSource:=False;
    lRDS.DataSet:=pDataSet;
  end;
end;
And dictionary filled with datasets in runtime (attached XML from TClientDataset:StitekReportDS.xml,TabulkaReportDS.xml,PatickaReportDS.xml)
procedure TRozpisObjednavekHandler.AssignDatasets;
begin
  DatasetsDictionary.AddOrSetValue('StitekReportDS',StitekDataCDS);
  DatasetsDictionary.AddOrSetValue('TabulkaReportDS',TabulkaDataCDS);
  DatasetsDictionary.AddOrSetValue('PatickaReportDS',PatickaDataCDS);
end;
In XML files data exist OK but when use ShowPrepareReport I got page without any MasterData,why?Preview result is in RozpisObjednavekOdberatelu.jpg
Please help me with this.
Comments