set report parameters with .csv files as datasource
【Source】
【Problem】
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.
【Answer】
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:
userName,date,saleValue,saleCount
Rachel,2015-3-1,4500,9
Rachel,2015-3-3,8700,4
Tom,2015-3-2,3000,8
Tom,2015-3-3,5000,7
Tom,2015-3-4,6000,12
John,2015-3-2,4000,3
John,2015-3-2,4300,9
John,2015-3-4,4800,4
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
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL