How to change Dataset and DataSource on Fly?

TGDTGD
edited 9:16PM 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 9:16PM
    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 9:16PM
    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 9:16PM
    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