. Use BIRT to generate reports from CSV

 

If you achieve data from CSV or other types of flat files in BIRT, you can s use Flat File Data Source. If you generate a dynamic parameter report, you can create a second dataSet to use the parameter and filter the original dataSet. If you use the Unformatted CSV file as a data source and produce the report, you need to implement Scripted Data Source to bring the data in. How can we query data and create a dynamic parameter report as SQL does with flat files? How can we use a simple and easy way replacing Scripted Data Source? How can we process the flat files all in one? The answer is using esProc in Birt.

Let’s take 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 show how to use parameters for CSV data source 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.

  undefined

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

  Query text:

  undefined

  Report parameter:

  undefined

  Set dataset parameters and link them to report parameters:

  undefined

  Step 3: Create a report

  The report is designed as follows:

  undefined

  Step 4: WEB preview, input parameters, preview results:

  (1)input parameter:Date 2015-03-02

  undefined

  undefined

For more examples, procedure text files refer to the following Structured Text Computing.

esProc provides JDBC driver, and can be easily integrated with BIRT and other reporting tools. Please refer to How to Call an SPL Script in BIRT

Read Getting Started with esProc to download and install esProc, get a license for free and find related documentation.