FastReport not show the fields with the defined data

edited July 20 in FastReport VCL


Comments

  • Hello, I am trying to display a report, based on the frxReport component of FastReport (Recomplie FAstReport 6 VCL Enterprise) in Embarcadero C++ Builder 10.2 using the data source of a DBGrid component.

    The problem is after compiling the form and executing the call to frxReport, which does not show the fields with the defined data: Please, could someone help me solve this problem or another possible solution?

    Thank you so much. Greetings. I have previously included the use of the classes necessary to access the data source. …

    #include "frxClass.hpp" #include "frxClass.hpp" #include "frxDBSet.hpp" #include "DB.hpp" ….

    Next, I show the code with the call to frxReport.

    void fastcall TForm3::BitBtn2Click(TObject Sender) { TfrxDataPage DataPage; TfrxReportPage Page; TfrxBand Band; TfrxMasterData DataBand; TfrxMemoView Memo; TfrxDBDataset *frxDataSet=new TfrxDBDataset(this); TfrxReportDataSets *frxDBDataset1=new TfrxReportDataSets(frxReport1); TfrxDataSet *frxDataset1=new TfrxDataSet(this); frxDataSet->DataSet=DBGrid14->DataSource->DataSet; frxReport1->DataSet=frxDataSet; frxDBDataset1=frxReport1->DataSets; frxDataset1=frxReport1->DataSet; DataPage = new TfrxDataPage(frxReport1); // add a page Page = new TfrxReportPage(frxReport1); // create a unique name Page->CreateUniqueName(); // set sizes of fields, paper and orientation by default Page->SetDefaults(); // modify paper's orientation Page->Orientation = poLandscape; // add a report title band Band = new TfrxReportTitle(Page); Band->CreateUniqueName(); // it is sufficient to set the «Top» coordinate and height for a band // both coordinates are in pixels Band->Top = 0; Band->Height = 20; // add an object to the report title band Memo = new TfrxMemoView(Band); Memo->CreateUniqueName(); Memo->Font->Size=14; Memo->Text = "Title of Report"; Memo->Height = 20; // this object will be stretched according to band's width Memo->Align = baWidth; // add the masterdata band DataBand = new TfrxMasterData(Page); DataBand->CreateUniqueName(); DataBand->DataSet = frxDataSet; // the Top coordinate DataBand->Top = 100; DataBand->Height = 20; // add a master data Memo = new TfrxMemoView(DataBand); Memo->CreateUniqueName(); // connect to data Memo->DataSet = frxDataSet; Memo->DataField = "Computer"; Memo->SetBounds(0, 0, 100, 20); Memo->DataField = "TimeRule"; Memo->SetBounds(105, 0, 100, 20); Band=new TfrxBand(Band); Memo->CreateUniqueName(); // adjust the text Memo->HAlign = haRight; Memo->Color=clBlack; // show the report frxReport1->PrepareReport(); frxReport1->ShowReport(true); }

  • Try

     TfrxDataset *frxDataSet=new TfrxDBDataset(this);

    // TfrxReportDataSets *frxDBDataset1=new TfrxReportDataSets(frxReport1);

    // TfrxDataSet *frxDataset1=new TfrxDataSet(this);

     frxDataSet->DataSet=DBGrid14->DataSource->DataSet;

     frxReport1->DataSets->Add(frxDataSet);

     frxReport1->EnabledDataSets->Add(frxDataSet);

    // frxDBDataset1=frxReport1->DataSets;

    // frxDataset1=frxReport1->DataSet;

     DataPage = new TfrxDataPage(frxReport1);

     // add a page

  • Hello gpi,

    Thank you very much for your suggestions. When we try to compile, the following error occurs:

    TfrxDataset *frxDataSet=new TfrxDBDataset(this);

    (TfrxDataset, frxDataSet) are not defined symbols in C++ Builder.

    frxDataSet->DataSet=DBGrid14->DataSource->DataSet;

    (->DataSet) is not a property of the TfrxDataset class.

    So, would the correct code be?:

    TfrxDBDataset *frxDataSet=new TfrxDBDataset(this);

    frxDataSet->DataSet=DBGrid14->DataSource->DataSet;

    frxReport1->DataSets->Add(frxDataSet);

    frxReport1->EnabledDataSets->Add(frxDataSet);

    DataPage = new TfrxDataPage(frxReport1);

    // add a page

    ...

    However, the code is equivalent to the previous one and does not solve the problem.

    Regards

  • TfrxDBDataset *frxDataSet=new TfrxDBDataset(this);

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.