TECH TIP: Printing Reports without a Database
ReportBuilder has a very flexible and powerful DataPipeline architecture for accessing data from a variety of sources. The product ships the following datapipelines:
- DBPipeline: connects to any TDataSource
- TextPipeline: used to accessing ASCII text files
- JITPipeline: event-handler based pipeline, used to print data from arrays, grids, lists or just about any source.
There are two components in ReportBuilder you can use to access data from sources other than a database: TppTextPipeline, TppJITPipeline. There is a section in the \Demos\Reports\demo.dpr project that contains example reports using these two components.
You can use the TextPipeline to print from ASCII files (comma-delimeted, tab delimeted, fixed-length etc.) There is also a demo of dynamically creating a text file and then printing from it. When you create a
TppTextPipeline at design-time you can double-click on the component and use the Fields editor to define the fields in the ASCII file. Once you configure everthing you can connect a TppReport to the TextPipeline and
the Fields that you defined can be used just like database fields. You can place a TppDBText on the report and select from the field from the list box. You can also create fields at run-time in code by the DefineField
The JITPipeline (Just In Time = JIT) can be used to print data from arrays, grids or other objects. Similar to the TextPipeline, you double-click to access the Fields editor and define the fields that will be used in the report designer. But whereas the TextPipeline handles the data-access for you, with the JITPipeline you code event-handlers to control all data-access yourself. So the JITPipeline is a custom pipeilne you control via events. In the Demo.dpr app there is an example of this.
You can also code TppDataPipeline descendants. TppBDEPipeline, TppJITPipeline, TppTextPipeline all descend from TppDataPipeline. We have customers with proprietary databases that have coded custom pipelines,
for example one customer coded a CTreePipeline to access that product. Once he completed this task, he could use that component in all his reports without changing the source code to ReportBuilder at all.