Working with FastReport Report Generator
Building a report with the help of a FastCube grid is very similar to creating standard cross-tab reports in the FastReport environment. To avoid repetition, refer to the parts of the FastReport manual dealing with cross-tab reports. However, the practicalities of creating a grid-based report are described here.
All grids use a multi-dimensional data structure (the cube) as their data source. A cube must contain data in a format that is suitable for grid construction. This minimizes the time required for building and setting up the grid. One cube may serve as a data source for an unlimited number of grids having different structures. Two elements are required for building a report:
- a cube (TfcxpCube) - the data source for the grid
- a cross-view (TfcxpCrossView) - the object representing the data in the grid
To build a grid-based report place a TfcxpCube object on the data sheet from the FastCube 2 palette. Then using the object inspector connect a dataset to this object, or enter the name of a previously created cube file.
The TfcxpCube object's main properties are:
- Dataset - a FastReport dataset : at the moment only TfrxDBDataset is supported
- FileName - a file name of a saved cube
- Active - shows whether or not the cube is active
if Active = True then multi-dimensional data structures are created inside the cube : these structures are filled either with the values from the Dataset or with the data from the cube file
if Active = False then the cube becomes inactive and its internal structures are empty
To build a cross-view the cube report should be active. To activate the cube report set its Active property to True.
The TfcxpSliceGridProvider object can be used as an alternative data source for TfcxpCrossView. TfcxpSliceGridProvider enables linkage of a TfcxSliceGrid component on the application's form with the TfcxpCrossView object.
The TfcxpChartView component enables inclusion of a chart in report. The TfcxpChartProvider object enables linkage of a chart with a component on the application's form.