There are two approaches you can use to pass a dataset to the engine. Both of these approaches use the call DataSourceProvider.setDatasets() to assign datasets to the data source.
- The first approach is to create the JdbcDataset objects in code. This class is documented in the Java Engine API. Create the dataset(s) and pass that array to the data source before processing that data source.
- The second approach is to create a POD file and pass that POD file to the data source. This enables you to design datasets in AutoTag and use those datasets. This approach is recommended and is detailed below.
Passing datasets to the engine via Pods is composed of two steps:
- Create a POD (.rdlx) file in AutoTag for the datasets. You do this by first defining the datasets in AutoTag and then creating a data source POD of your data source with the datasets in it. Note: You can create the RDLX file in any XML editor, but using AutoTag is the fastest and easiest approach.
- When you run the engine, you load up the datasets in the RDLX file and pass the datasets to the data source.
We will cover step 2 here (go to the AutoTag Datasets page for step 1). First create the JdbcDataSource object for the data source you are going to apply to the report.
Next you call DatasetBase.readPod() passing it a stream to the RDLX file and the name of the data source (not dataset) who's datasets you want it to read. Normally the name you pass here and the name of your data source will be the same - but there is no requirement that they match.
You then pass the returned JdbcDataset to JdbcDataSource.setDatasets(). When you assign to Datasets, it will discard any previously set datasets.
Now call Report.processData() with your data source.
JdbcDataSource jds = new JdbcDataSource(className, url, username, password); FileInputStream fs = new FileInputStream(podFilename); jds.setDatasets((JdbcDataset) DatasetBase.readPod(fs, datasourceName); fs.close(); report.ProcessData(ads, datasourceName);