如何在按值迭代时删除空行? [英] How to remove empty lines when iterating by values?

查看:106
本文介绍了如何在按值迭代时删除空行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的xml数据:

I've got xml data like this:

<root>
    <eee>aaa</eee>
    <eee>bbb</eee>
    <eee>ccc</eee>
    <eee>ddd</eee>
</root>

我想在我的元素中显示元素 eee 详细信息乐队。因此我添加了 textField ,其中包含表达式 $ F {My_elem} ,我得到:

I want to displays elements eee in my detail band. Therefore I added textField that contains expression $F{My_elem} and I get:


aaa

bbb

ccc

ddd

aaa
bbb
ccc
ddd

它看起来还不错,但问题是当我将Print when表达式添加到我的textField中时:

It looks pretty good but the problem is when I add "Print when" expression into my textField which is:

$V{REPORT_COUNT}%2==1

我的报告显示:


aaa





ddd

aaa


ddd

但我的目的是显示:


aaa

ddd

aaa
ddd

空白设置为TextField不起作用时删除行。

"Remove line when blank" set to TextField does't work.

当元素按元素迭代时,如何显示空白行?

How can I not display the blank line when details bound iterate by elements?

推荐答案

将打印时间表达式移至明细

Move the "Print when" expression to the detail band

<detail>
    <band height="20">
        <printWhenExpression><![CDATA[$V{REPORT_COUNT}%2==1]]></printWhenExpression>
        .... your text fields...
    </band>
</detail>

这样一来,而不是说你的 textField 不应该显示,你告诉报告删除整个详细信息 band

This way instead of saying that your textField should not be displayed, you tell the report to remove the whole detail band

这篇关于如何在按值迭代时删除空行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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