This article guides you through the creation of your first report built with FastReport and AnyDAC.
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:
After installation TfrxADComponents component will appear on FastReport palette.
To get started with creating your first report you will need to drop the following components onto your form:
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.
Now you are ready to create the report: right click frxReport1 and choose Edit report...
TfrxReport component editor area consists of a left-most tool palette and three pages: 'Code', 'Data' and 'Page1'.
Select the 'Data' page. On the tool palette you can see the following components:
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.
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.
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.
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.
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!
|