How to create a report using quick reports without connecting directly to the database

I was asked by my company to update the reporting functionality of the paticular application written in delphi and use Quick Reports to use FastReports.

The current implementation extracts all the data from the database, does a great job of organizing and calculating the required data for the reports, and saves it all in several different objects. Quick Report OnNeedData events are then used to populate the bars until there is more data (indicated by setting MoreData = false)

The problem I ran into is Fast Reports, it seems I need a group to connect to a real data source that I don’t have. Also fastReports is not like an event like OnNeedData.

In any case, to fill in the data range values ​​in the code and print it again until all the data is printed without connecting the strip to the data set?

I attribute the vagueness of this question, I am very new to creating software and any suggestions on where to go and what to see. It would be very grateful.

+6
source share
5 answers

Quick reports use an intermediate object descending from _TFrxDataSet to connect the report engine that it prints.

To connect a report to a data source controlled by the program itself, you use the TfrxUserDataSet component, which allows you to see the data set inside the report, but you manually specify the column names in the Fields (TStrings) property and control and feed values ​​programmatically record event handlers for the following events:

  • OnCheckEOF is functionally equivalent to OnNeedData, if there is no more printing, you set the EOF var parameter to true
  • OnFirst you do everything you need to start your data search.
  • OnGetValue and OnNewGetValue you provide values ​​for each of the different columns of the current row
  • OnNext , OnPrior you move the current line to the next or one previous position.

As you can see, the concept of a row / column (DataSet) is used to represent data in a report, but you can extract data from any structure used to store the results of your calculations (lists, arrays or any other object / structure / file, etc. )

Inside the report, you bind a group to this logical DataSet and use standard components to print the column values ​​of this data set.

If you already have data in a DataSet, for example, in a DataSet in memory after your calculations, it is better to use TfrxDBDataset to directly bind your report to this data source.

+7
source

you can use TfrxUserDataSet. In the demos folder there is a demo version of printstringlist.

+2
source

In our project, we implemented our own class inherited from TfrxCustomQuery. This new query class simply redirects its SQL queries to our internal query engine. We registered this new class in the FastReport panel (we used frxDsgnIntf.frxObjects.RegisterObject * for FR versions 3 and 4), and now it is used in all our report templates instead of TfrxADOQuery or other built-in dataset classes.

+1
source

Here is another alternative:

I have been using FastReport for many years. Sometimes I come across a similar situation. For stand-alone table reports, I use a dataset in memory. I bought DevExpress a long time ago and therefore I have TdxMemData. But even without this, you should be happy with the TClientDataset component.

In addition, TfrxUserDataset is an alternative that I use when displaying lists of objects.

+1
source

There is an opportunity to do it this way, but slowly,

Code: -

var FRX: TfrxReport; procedure NewPage; begin MyPage := TfrxReportPage.Create(FRX); MyPage.CreateUniqueName; MyPage.PaperSize := DMPAPER_A4; end; procedure ...(AText: string); var frMemo : TfrxMemoView; begin frMemo := TfrxMemoView.Create(MyPage); frMemo.CreateUniqueName; frMemo.Text := AText; end; 

respectfully
Hermann

0
source

All Articles