Change dataset in all objects on report

edited 9:26AM in FastReport 4.0
Hi!

i want to change dataset in all object on report in runtime. So I have folowing code ( from here)
procedure ReportDatasetChange(Raport: TfrxReport; Dataset: TfrxDataset);
  var i,c: integer; component: TfrxComponent;
begin
  for i := 0 to Raport.PagesCount - 1 do begin
    for c := 0 to Raport.Pages[i].Objects.Count - 1 do begin
      component := tfrxComponent(Raport.Pages[i].Objects[c]);

      if component is tfrxMemoView then begin
        if tfrxMemoView(component).Dataset <> nil then // maybe <> nil, I didn't try compiling this code, I'm just posting it in the forum.
          tfrxMemoView(component).Dataset := Dataset;
        // maybe you need this too, test it:
        tfrxMemoView(component).text := '';
      end;
        //repeat situation for bands, or any other db type :
      if component is tfrxMasterData then
        tfrxMasterData(component).Dataset := Dataset
    end;
  end;
end;

But it does not loop through any MemoView on the report. Any ideas?

Comments

  • edited 9:26AM
    Ok, problem solved - I'm looping through Report.AllObcject

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.