Create a Side-by-side BIRT Report
【Question】
I have a table which displays User ids in one column. I want to display that column as two columns.
Ex: In First Row, First user id in Column 1 and Second user id in Column2,
In Second Row, second user id in Column 1 and third user id in Column2,
In Third row, third user id in Column 1 and fourth user id in Column2,
【Answer】
It involves inter-row calculation. It’s too complicated for SQL or a reporting tool, like BIRT. So we can prepare the report source in the horizontal format separately. Here we use esProc to do this. The script is as follows:
A |
|
1 |
=db.query("select col1 from sorder") |
2 |
=create(${2.((t=~,A1.fname().(~+string(t)))).conj().concat@c()}) |
3 |
=A2.record(A1.conj([~[-1],~]).to(3,).(#1)) |
A1: Retrieve data from the source table.
A2: Create a table in the specified format.
A3: Populate values to the horizontally arranged table using record() function.
BIRT can access esProc through JDBC and calls the script in same way as calling a stored procedure. Details are explained in How to Call an SPL Script in BIRT.
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