Create a Landscape Orientation Report

Question

I have a single list of employees, where each employee has their name and salary. I have given the list of employees to a table but it appears as follows:

 

Employee Name**  Salary**

harish            3000

kiran             4000

Emili             6000

harsha            7000

vardhana          8000

siri                9000

 

Each employee appears in a single row. But I want them to appear side by side on the same page as shown below:

Employee Name**  Salary****  Employee Name****  Salary**

harish             3000       harsha             7000

kiran              4000       vardhana           8000

Emili              6000       siri                9000

 

A solution:

The code is written over filtered table1:

pageBreakInterval=21;

blockNumber=Math.floor(row.__rownum/pageBreakInterval)+1;

totalColumns=3;

columnNumber=1;

((blockNumber-columnNumber)>=0)&&(((blockNumber-columnNumber)% totalColumns)==0)

on table-2 filter the following code is written

pageBreakInterval=21;

blockNumber=Math.floor(row.__rownum/pageBreakInterval)+1;

totalColumns=3;

columnNumber=2;

((blockNumber-columnNumber)>=0)&&(((blockNumber-columnNumber)% totalColumns)==0)

on table-3 filter the following code is written

pageBreakInterval=21;

blockNumber=Math.floor(row.__rownum/pageBreakInterval)+1;

totalColumns=3;

columnNumber=3;

((blockNumber-columnNumber)>=0)&&(((blockNumber-columnNumber)% totalColumns)==0)

With the above code, among 3 table filters I guess the first table will be filled with first 21 records and the next 21 records will be filled in the second table and the next to next 21 records will be filled in the third table. Is this right?

 

Answer

BIRT supports creating horizontally oriented reports. You can configure it in columns property under master page tag. Or you can prepare data in the specified format in SPL (Structured Process Language) and return it to the reporting tool for presentation. Below is the SPL script:

A

1 1

=demo.query(“select   orderID,customer from orders”)

2 2

=create(${Col.((t=~,A1.fname().(~   +string(t)))).conj().concat@c()})

3 3

>Row.run(A2.record(A1.m(to(Col*(~-1)+1,Col*~   )).conj(~.array()))

The final result:

undefined

A1: Data retrieval.

A2: Create a table with a number of column groups determined by parameter Col.

A3: Group the source data every a number of rows (the number is specified by parameter Row) to generate a new data set with a specified number of column groups (specified by parameter Col).

You can connect to esProc from BIRT via JDBC and call the SPL script as calling a stored procedure. For detailed information, see How to Call an SPL Script in BIRT.