How to remove empty lines when iterating by values?

余生长醉 提交于 2020-01-06 03:31:07

问题


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:


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



来源:https://stackoverflow.com/questions/34880016/how-to-remove-empty-lines-when-iterating-by-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!