Dynamic create TfrxDBdataset issue

edited November 2017 in FastReport VCL 5
hi

I designed a report by fastreport 5 , dynamic Create Tfrxreport ,TfrxDBdataset ,TFDmemtable(firedac) and found a problem with TfrxDBDataset ,
this TFrxDbdataset's data doesnt refresh ,always same data in it ,TFDmemtable's data is normal

below is code :

var

i, j: integer;
lTable: TFDMemTable;
lSource: TFDMemTable;
aDBset: TfrxDBDataset;
lCountSetName, lFieldName, lResultFieldName: string;
frxpt : TfrxReport ;

begin
frxpt := TfrxReport.create(nil) ;
frxpt.datasets.clear ;
frxpt.loadfilefrom('xxx.fr3');

for i := 0 to lSource.RecordCount - 1 do
begin
lTable := TFDMemTable.Create(nil);
lTable := (CreateSchemaTable('CNTMB')); //
if not Assigned(aTable) then
begin
MessageBox(0, 'create schema fail', 'warn', 48);
exit;
end;
lTable.Open;
lCountSetName := 'SN' + lSource.FieldByName('MB001').AsString;
lTable.Insert;
for j := 0 to lTable.FieldDefs.Count - 1 do
begin
begin
lFieldName := lTable.Fields[j].DisplayName;
lResultFieldName := lSource.Fields[j].DisplayName;
lTable.FieldByName(lFieldName).AsString := lSource.FieldByName(lResultFieldName).AsString;
end;
end;
lTable.Post;
lTable.Open;
aDBset := TfrxDBDataset.Create(nil);
aDBset.UserName := lCountSetName;
aDBset.DataSet := lTable;
frxpt.DataSets.Add(aDBset);
lSource.Next;
end;

frxpt.showreport

plz help ,thanks

Comments

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.