Crystal Reports Custom Data Sources


Crystal Reports Custom Data Sources

Crystal Reports includes additional capabilities to base reports on data sources you create in a custom-designed application. These data sources (sometimes referred to as Active Data Sources) are a departure from typical relational databases, such as Microsoft Access or Oracle. Custom data sources are often used to provide data to Crystal Reports from another program that s running separately on your PC. Such separate programs might be connecting to real-time instrumentation (such as measuring devices). Or, you may be designing a report to integrate within a custom Windows program and wish to connect to a data source exposed by the application.

These custom data sources appear in the Database Expert:

  • COM Connectivity This connectivity method allows your report to get data (in a typical table field and record fashion) from a program or automation server that conforms to Microsoft s COM (Component Object Model) standard. These programs can be developed in any COM-compatible language, such as Visual Basic or Visual C++.

  • Crystal Data Object This connectivity method allows your report to get data (in a typical table field and record fashion) from a program that is actually generating the data on the fly. Custom Windows programs can use the Crystal Data Object to create a field and record structure necessary for Crystal Reports entirely within their internal logic.

  • Java Beans Connectivity This connectivity method allows your report to get data (in a typical table field and record fashion) from a Java-based program that exposes a set of Java classes that use a Java Data Provider.

    Note  

    These custom data sources are available only with Crystal Reports Developer or Advanced Developer editions.

To connect to a custom data source, begin a new report as you normally would with a relational database. You may use a wizard or the Blank Report option. In either case, expand the Create New Connection category of the Database Expert to proceed. You ll see entries for each of the active data sources (if you don t see the data source you need, you may need to re-run Crystal Reports setup and add the data source). Click the plus sign next to the desired data source.

If, for example, you choose COM Connectivity to connect to an exposed COM automation server, you ll be presented with a dialog box asking you to specify the Program ID of the automation server. Type in the exact name of the COM data source (that you either specified when you developed the program that exposes the automation server, or the name given you by the program s designer).

click to expand

Once you ve supplied the proper Program ID, click Finish. The Database Expert will return with a new entry in the Available Data Sources list (record sets returned by active data sources will often appear similar to SQL stored procedures). Select the data source or sources you wish to base the report on and add them to the Selected Tables list. If a data source requires a parameter value to be supplied, you ll be prompted for it much as you are prompted when using a parameterized stored procedure.

click to expand

Supply any necessary parameters and click OK. Once you ve added the active data source, close the Database Expert. Fields exposed by the active data source will appear in the Field Explorer as with any other standard data source.

Tip  

For more information on custom data sources, including sample code to create programs that expose data in this fashion, consult the online Technical Reference from the Crystal Reports program CD.




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net