How to change Dataset and DataSource on Fly?

TGDTGD
edited 6:50AM in FastReport 3.0
StmpTab.DS1.DataSet := DM.ArcTab;
StmpTab.DS1.DataSource := DM.DSTab;
StmpTab.StTab.DataSets.Clear;
StmpTab.StTab.DataSets.Add(StmpTab.DS1);
StmpTab.StTab.LoadFromFile(DM.cPth + 'Templates\TabeVet.fr3');
StmpTab.StTab.ShowReport;

What's wrong?

TGD

Comments

  • edited 6:50AM
    Should be

    StmpTab.DS1.DataSet := DM.ArcTab;
    StmpTab.DS1.DataSource := DM.DSTab;
    StmpTab.StTab.LoadFromFile(DM.cPth + 'Templates\TabeVet.fr3');
    StmpTab.StTab.DataSets.Clear;
    StmpTab.StTab.DataSets.Add(StmpTab.DS1);
    StmpTab.StTab.ShowReport;
  • TGDTGD
    edited 6:50AM
    AlexTZ wrote:
    Should be

    StmpTab.DS1.DataSet := DM.ArcTab;
    StmpTab.DS1.DataSource := DM.DSTab;
    StmpTab.StTab.LoadFromFile(DM.cPth + 'Templates\TabeVet.fr3');
    StmpTab.StTab.DataSets.Clear;
    StmpTab.StTab.DataSets.Add(StmpTab.DS1);
    StmpTab.StTab.ShowReport;
    I thank you for suggestions, but it doesent works.

    I previously converted an old FR2.7 list report changing old [DM.ArcTab."CodTab"]
    with [DS1."CodTab"] (picked from the dabase list in DesignReport), but no value printed. It means an empty report is displayed.

    What's wrong?

    ;) TGD
  • edited 6:50AM
    I can't say what's wrong. Probably you should redesign your old report (avoid setting TfrxReport.DataSets in code, do it in the report designer).

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.