简体   繁体   English

在iReport中打印表达式时

[英]Print When Expression in iReport

I am trying to do a simple expression in iReport, but whatever I try seems has given me an error. 我试图在iReport中做一个简单的表达,但无论我尝试什么似乎给了我一个错误。 It seems like such a simple thing to do, but whenever I try to do anything in Java it takes me about 20 tries to get it right. 这似乎是一件很简单的事情,但每当我尝试用Java做任何事情时,我都需要大约20次尝试才能做到正确。

All I'm trying to do is show a subreport when the value of an integer field is not zero. 我想要做的就是在整数字段的值不为零时显示子报表。 I am using the Print When Expression for the subreport control. 我正在使用Print When Expression进行子报表控件。

Here's a few (of the many) things that I've tried: 以下是我尝试过的一些(很多)事情:

$F{count}!=0

$F{count}!=Integer(0)

!$F{count}.compareTo(0)

Obviously my Java sucks. 显然我的Java糟透了。 Any help would be appreciated. 任何帮助,将不胜感激。 Thanks. 谢谢。

new Boolean($F{count}.intValue()!=0)

很高兴我可以帮忙。

w00t! w00t! 35th time's a charm. 第35次是魅力。 I finally got the following expression to work. 我终于得到了以下表达式。 If anyone can tell me why, I would appreciate it. 如果有人能告诉我为什么,我会很感激。

new Boolean($F{count}.compareTo(new Integer(0))!=0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM