AnyDAC
ContentsIndexHome
PreviousUpNext
Creating Reports with FastReport

This article guides you through the creation of your first report built with FastReport and AnyDAC.

Group
Links
Installation

AnyDAC installer is shipped with FastReport add-on's that can be found in AnyDAC\AddOn\FastReportN folders. Where N corresponds to your FastReport version. 

To install the add-on please:

  • open the project group that matches your FastReport and Delphi version;
  • compile frxADXX.dpk and dclfrxADXX.dpk packages;
  • right click dclfrxADXX.dpk package and select Install.

After installation TfrxADComponents component will appear on FastReport palette. 

 

Before creating first report

To get started with creating your first report you will need to drop the following components onto your form:

  • TADConnection;
  • TADGUIxWaitCursor;
  • TADPhysXXXXDriverLink;
  • TfrxADComponents;
  • TfrxReport.

 

Components 

 

The first three components are used for connecting to your database. TfrxADComponents is used to link FastReport components with AnyDAC components. 

Set frxADComponents1.DefaultDatabase property to ADConnection1. This connection will be used by default for all datasets you create for the report. 

 

Setup frxADComponents 

 

Now you are ready to create the report: right click frxReport1 and choose Edit report... 

 

Adding datasets to report

TfrxReport component editor area consists of a left-most tool palette and three pages: 'Code', 'Data' and 'Page1'. 

 

FR Editor 

 

Select the 'Data' page. On the tool palette you can see the following components:

  • AD Database;
  • AD Table;
  • AD Query;
  • AD StoredProc.

All of them match the respective AnyDAC components: TADConnection, TADTable, TADQuery and TADStoredProc. To access a table in your database click AD Query on the palette and then click on the empty Data area. 

 

Add Query 

 

This will add ADQuery1 component that can be configured in the Object Inspector similarly to how you would do that in Delphi IDE. Double click the component and enter the SELECT query to your table. 

 

Select Data 

 

When applied the Data Tree will show the queried fields. 

The same way you can configure the other datasets. In case you need to use more than one connection or connect to different DBMS's you can drop AD Database components to the data area. Dataset components Database property then should be set to the appropriate ADDatabase. Also in this way you will need to drop TADPhysXXXXDriverLink to your form or data module corresponding to DBMS used. 

 

Using datasets

Select 'Page1' of the FastReport editor. Added datasets are available in the Data Tree. Expanding the dataset nodes will allow you to drag and drop the required field to the page area to build the report. 

 

Drag and drop Query fields 

AddOn\FastReportX\Example folder contains a pre-configured sample that can be used to get started with FastReport and AnyDAC.

What do you think about this topic? Send feedback!