纵向分栏

博客内容讲述了如何利用SPL脚本来处理BIRT报表的分栏显示。原始问题是在BIRT报表中,员工的姓名和薪水信息没有正确地并排显示,而是每条记录单独占据一行。技术人员提供的解决方案涉及在三个不同的表格过滤器中使用代码,每个表格负责显示一部分记录,以此达到分栏的效果。然而,更通用的方法是通过调整BIRT报告的masterpage设置或者直接在SPL中预处理数据,生成适合不分栏显示的格式。

【问题】

Hi i have a single list of employees. Each employee will have his 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

i mean each employee details 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

----- 技术支持给的解法:代码实现

on table one filtering, the following code is written
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)

hi with the above code in 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?

【回答】

BIRT 有分栏打印的功能,具体在 master page 标签页的 columns 属性,可以试一下。如果这种方法无效,则可以用 SPL 准备好已分栏后的数据,然后作为不分栏的表呈现即可,可以通用地解决这个问题:

A
1=demo.query(“select orderID,customer from orders”)
2=create(${Col.((t=~,A1.fname().(~ +string(t)))).conj().concat@c()})
3>Row.run(A2.record(A1.m(to(Col*( ~ -1)+1,Col*~ )).conj(~.array()))

运行结果:

A1:查找数据

A2:创建表,并根据参数 Col 设置分栏数目

A3:将源数据按参数 Row,每 Row 行分成一组,拼成 Col 列生成新数据集

BIRT 可以通过 JDBC 连接集算器,调用脚本方法和调用存储过程一样,详情参考【BIRT 调用 SPL 脚本​】。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值