在报告的详细信息区域中添加其他行 [英] Adding additional rows in report's Detail band

查看:118
本文介绍了在报告的详细信息区域中添加其他行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理 JR 报告并使用 iReport 生成它们。

I am working on JR reports and using iReport to generate them.

我正在寻找此任务的解决方案: Detail 乐队必须有六条记录。例如,查询从数据库中获取3条记录,然后详细信息带将有3行,但我想将剩余的3行作为空行打印。

I'm looking for solution for this task: the Detail band must have six records. For example, the query fetch 3 records from database then the detail band will have 3 rows, but I want to print 3 remaining rows as blank rows.

如何使用 iReport 进行操作?

推荐答案

我能想到的最好的方法是让你的查询返回6行(或你的行数#),然后jasper就不需要做任何与众不同的事了。

The best way i can think to do this is to make your query return 6 rows (or your set # of rows) then there is no need for jasper to do anything out of the ordinary.

以下是oracle 10或更高版本如何实现这一目标的一个示例 - 我确信有更好的方法可以做到这一点。

Here is an example of how you might do that with oracle 10 or greater -- I am sure there are better way to do this.


with gen_6

- 创建一个包含6行的表格(生成系列)< br>
as(SELECT LEVEL as row_num

FROM dual

CONNECT BY LEVEL< = 6),



Your_Query为

with gen_6
-- creates a table of 6 rows (generate series)
as (SELECT LEVEL as row_num
FROM dual
CONNECT BY LEVEL <= 6),

Your_Query as

 -- your query here <BR>
    (select SYSDATE, ROWNUM as row_num from dual where rownum <=6)<BR>

从gen_6中选择*

使用(row_num)加入your_query

by row_num

select *
from gen_6 left join your_query using (row_num)
order by row_num

FYI

您甚至不需要将字段row_num添加到报表中以使其正常工作。

You do not even need to add the "field" row_num to your report for this to work.

这篇关于在报告的详细信息区域中添加其他行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆