Default dataset

Hi


I use the code below for setting some default settings and opening the formdesigner


  FormMain.frxDesigner.OpenDir               := sMapWRISTBAND;

   FormMain.frxDesigner.SaveDir               := sMapWRISTBAND;

   FormMain.frxReportWristband.PreviewOptions.Zoom      := 1;

   FormMain.frxReportWristband.EngineOptions.DestroyForms := False;

   FormMain.frxReportWristband.DataSetName          := 'Print';

   FormMain.frxReportWristband.DataSet            := frxDBDataset_Print;

   FormMain.frxReportWristband.Clear;


   // Star designer

   FormMain.frxReportWristband.DesignReport;


Now i need two things:

  • assign by code the correct dataset (the version is in dutch below) but see dataset {niet toegewezen}
  • the user can NOT select a other dataset (main menu / Report / )



Comments

  • Use TfrxReportPage(frxReport1.FindObject('Page1')).Dataset := ...

  • mierlpmierlp Netherlands

    Where or how to use?

  • gpigpi
    edited January 2021

    FormMain.frxDesigner.OpenDir              := sMapWRISTBAND;

       FormMain.frxDesigner.SaveDir              := sMapWRISTBAND;

      FormMain.frxReportWristband.Clear;

       FormMain.frxReportWristband.PreviewOptions.Zoom     := 1;

       FormMain.frxReportWristband.EngineOptions.DestroyForms := False;

    FormMain.frxReportWristband.DataSets.Add(frxDBDataset_Print);

    FormMain.frxReportWristband.EnabledDataSets.Add(frxDBDataset_Print);

      // FormMain.frxReportWristband.DataSetName         := 'Print';

      // FormMain.frxReportWristband.DataSet           := frxDBDataset_Print;

    TfrxReportPage(FormMain.frxReportWristband.FindObject('Page1')).Dataset := frxDBDataset_Print;

  • mierlpmierlp Netherlands

    When i add this line: TfrxReportPage(FormMain.frxReportWristband.FindObject('Page1')).Dataset := frxDBDataset_Print;


    i get the following error on runtime


  • Create small demo project and send it to support@fast-report.com

  • Set frxReportWristband.StoreinDFM = True, load or create report teplate with Page1 report page and use

    <CODE>procedure TForm1.D1Click(Sender: TObject);

    begin

     frxDesigner.OpenDir                          := 'C:\TEMP';

     frxDesigner.SaveDir                          := 'C:\TEMP';


     //frxReportWristband.Clear;

     frxReportWristband.PreviewOptions.Zoom       := 1;

     frxReportWristband.EngineOptions.DestroyForms := False;

     frxReportWristband.DataSets.Add(frxDBDataset_Print);

     frxReportWristband.EnabledDataSets.Add(frxDBDataset_Print);


     frxReportWristband.DataSetName               := '';//'Print';

     frxReportWristband.DataSet                   := nil;//frxDBDataset_Print;

    //Page1 should exists in the report template, don't clear it

     TfrxReportPage(frxReportWristband.FindObject('Page1')).Dataset := frxDBDataset_Print;


     // Star designer

     frxReportWristband.DesignReport;

    end;</CODE>

Leave a Comment