Create a Side-by-side Report
【Question】
I would like to create a table that should be vertical orientation, that means each result set row should be filled from left to right.
Can I achieve this without using crosstab?
【Answer】
You can first prepare the source data with esProc and then pass the result set to the reporting tool to display. The esProc SPL (Structured Process Language) script is simple and easy to understand:
A |
|
1 |
=myDB1.query("select EId,Name,Dept from employee") |
2 |
=create(${Col.((t=~,A1.fname().(~+string(t)))).conj().concat@c()}) |
3 |
>round(A1.len()/Col).run(A2.record(A1.m(to(Col*(~-1)+1,Col*~)).conj(~.array()))) |
Col is a report parameter that defines the column group count.
A1: Retrieve data from employee table.
A2: Create table where data is arranged in a side-by-side format.
A3: opulate A1’s records to the side-by-side table.
A reporting tool can access an SPL script via JDBC in the same way as it calls a result set in a database. See How to Call an SPL Script in Java to learn details.
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