. Using SQL to parse CSV files in BIRT
You have CSV files that look something like this:
Test, Result, Case, Type
------------------------
t1 , pass , c1 , Functional
t2 , fail , c1 , Operational
t3 , fail , c2 , Functional
t4 , fail , c2 , Operational
For example, You want to get a single-column list of the unique values of the ‘Type’ column:
Type
--------
Functional
Operational
or a summary of each type:
Type TypeNum
-------- ----------
Functional 2
Operational 2
If you were hitting a database, you could use some SQL like
SELECT DISTINCT type
FROM thatFile
or
SELECT Type, sum(*) as TypeNum
FROM thatFile
It seems in BIRT that it doesn’t have that luxury.
But you are able to query the data in the CSV files with esProc using SQL.
Here is the esProc SPL script:
A | |
1 | $select DISTINCT type from ./test.csv |
2 | $select Type,sum(*) as TypeNum from ./test.csv group by Type |
The report can be designed in the same way as you would if you were retrieving the data from a database. For detail SPL integration with BIRT, see How to Call an SPL Script in BIRT.
For many difficult calculations of Text Computing, you can refer to Structured Text Computing.
If you have any questions or comments, please leave them below.
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
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