How to remove empty lines when iterating by values

2019-08-15 06:16发布

I've got xml data like this:

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

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

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

$V{REPORT_COUNT}%2==1

My report displays:

aaa


ddd

But my aim is to display:

aaa
ddd

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

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

1条回答
别忘想泡老子
2楼-- · 2019-08-15 07:02

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>

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

查看更多
登录 后发表回答