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,

undefined

 

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.

undefined

A2: Create a table in the specified format.

undefined

A3: Populate values to the horizontally arranged table using record() function.

undefined

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.