Data sources

Top  Previous  Next

Ordinarily, the data source represents a DB table or SQL query. There can be several data sources in a report. For most of reports, only one data source is needed. A report like Master-Detail needs two data sources which are connected to each other using a relation (we will learn about it later in this chapter).

 

Data source has one or several data columns. Each column has a definite data type. To look at column type, select it and open the "Properties" window. Column type is indicated in the "DataType" property. The icon near the column name also helps to determine its type.

 

There are two ways to define a data source for the report.

 

The first method - data source is defined in the application and registered in a report. It's up to the programmer who created this application (see details in the "Programmer's manual"). A user should only choose the needed data source in order to use it in a report. It can be done in the "Data|Choose Report Data..." menu.

 

chooseData

 

All data registered in a report is listed in this window. Just tick off those data which are needed in your report. It can be done  at any moment while working with a report.

 

The second method - you create a new data source yourself. It can be a DB table or a SQL query. In such a case, data source definition is saved in a report file.

 

FastReport allows connecting to many popular DBMS (data base management systems) such as MS SQL, Oracle, Interbase, Access. Besides this, you can use data files which are saved in xml/xsd format.

 

DB table content is not saved in a report file. Instead, the connection string and the data source schema are stored. A connection string can contain such data as login and password, that is why it is kept ciphered in a report file. When needed, you may increase the safety by using own key for data ciphering. In this case a report file can be opened correctly only in your program.