单字段纵向分栏

【问题】

Hi,

I’m trying to display BIRT report Data (only one field) first vertically till the page ends and then it should continue in the next column of the same page. For example as

A  E  I

B  F  J

C  G

D  H

By using list element I’m able to get the data in horizontal first and then vertically like…

A  B  C  D

E  F  G  H

I  J

But I need the data to be displayed in the report as first example. Can this be done using List element? Please let me know how to do this. Appreciate your help.

【回答】
上述这种对单字段分栏的报表用集算器准备数据源会好实现得多,代码很简单:



A

1

=myDB1.query("select orderID from sorder").(orderID)

2

=A1.(~.string().split())

3

=to(A2.max(~.len()))

4

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

5

=A4.record(A3.conj(A2.(~.m(A3.~))))

6

return A5

A1:查询表数据

1png

A2:对 A1 的字段值做拆分

2png

A4:创建分栏后的表结构

3png

A5:将 A2 记录填入分栏后的表

4png

报表工具中可通过 JDBC 访问集算器脚本,像数据库一样使用,参考Java 如何调用 SPL 脚本