Monday, July 29, 2019

set report parameters with .csv files as datasource



our datasource is multiple csv files. we want to set the report parameters to this. How can we do that.

using query birt provides the option of wild cards and linking of report parameters to dataset parameters. But when .csv files are our datasource there is no option of sql query. In such cases , how can we set the report parameters.


SQL query in birt can specify dataset parameters. When dataset parameters are used, they can also be linked to a report parameter, which is simple and easy to operate. Of course, if you want to query data files of CSV type, it is also very convenient, but the dataset of CSV type does not support the specified dataset parameters. If you want to achieve filtering, you can only use the dataset filtering function, and there are some limitations when you use it. Therefore, here we recommend a useful tool - esProc, which is easy to operate and learn, can both filter and transmit parameters, and there are many benefits.

Let's take Birt reporting tool as an example to introduce the implementation process:

In this example, employee sales information is stored in sale. csv, and employee information with dates greater than 2015-03-02 needs to be queried based on input parameters.
sale.csv data are as follows:

Here we take accessing local CSV files as an example to show how to use parameters for CSV datasets in birt.
The integration of BIRT with esProc is not introduced here. Please refer to《How to Call an SPL Script in BIRT》.
Step 1: Add an esProc JDBC data source


Step 2: Add the dataset and write the SQL query CSV file directly.
Query text:

Report parameter:

Set dataset parameters and link them to report parameters:

Step 3: Create report
The report is designed as follows:

Step 4: WEB preview, input parameters, preview results:
(1)input parameter:Date 2015-03-02