隐藏多个细节带

发布于 2024-11-06 11:28:08 字数 983 浏览 3 评论 0原文

我有一个包含子报告的报告,用于向主报告添加徽标。在此子报告中,我有 2 个细节带来支持两个不同大小的徽标;一个是长的,另一个是大约三分之一长(宽度)的。有点像这样...

...........................
|---------logo------------|
address 1, address 2
...........................
|__logo__|    address 1
|        |    address 2
...........................

第一行和第二行之间是详细信息 1 区域,第二行和第三行之间是详细信息 2 区域。

我正在尝试使用“Print When Expression”根据 $F{LogoName} 的值切换第一个或第二个细节带。

细节1频段:

new Boolean($F{LogoName}=="acompanyname")

细节2频段:

new Boolean($F{LogoName}!="acompanyname")

但不起作用。

还尝试过这些:

(($F{LogoName}=="acompanyname")?Boolean.TRUE:Boolean.FALSE)
(($F{LogoName}!="acompanyname")?Boolean.TRUE:Boolean.FALSE)

$F{LogoName} 是“acompanyname”。

每次我运行报告时,仅显示详细信息 2 波段。我根本无法显示详细信息 1,也没有收到任何错误消息。

欢迎任何帮助。

谢谢

I have a report with a subreport to add a logo to the main report. In this subreport I have 2 detail bands to support two differently sized logos; one is long and the other is about a 3rd a long (width). kind of like this...

...........................
|---------logo------------|
address 1, address 2
...........................
|__logo__|    address 1
|        |    address 2
...........................

Between the 1st and 2nd row of periods is the Details 1 band and between the 2nd and 3rd is Details 2 band.

I am trying to use the "Print When Expression" to toggle the 1st or 2nd Detail band depending on the value of $F{LogoName}.

Detail 1 band:

new Boolean($F{LogoName}=="acompanyname")

Detail 2 band:

new Boolean($F{LogoName}!="acompanyname")

but it does not work.

Have also tried these:

(($F{LogoName}=="acompanyname")?Boolean.TRUE:Boolean.FALSE)
(($F{LogoName}!="acompanyname")?Boolean.TRUE:Boolean.FALSE)

The $F{LogoName} is "acompanyname".

Every time I run the report only Detail 2 band shows. I can not get details 1 to show at all and I am not getting any error messages.

Any help is welcome.

Thank You

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转身泪倾城 2024-11-13 11:28:08

试试这个:

$F{LogoName}.equals( "acompanyname" )

在 Java 中,等号运算符 (==) 在对象上使用时,会检查它们是否是对同一对象的相同引用。这适合所有没有大量 Java 编程经验的报表开发人员。您可以这样写:

$F{LogoName} == $F{LogoName}

这将返回 true,如您所料,因为 equals 运算符两侧的两个对象是相同的。考虑以下情况:

public class T { 
  public static void main( String args[] ) {                                    
    String s1 = "hello";                                                        
    String s2 = (new StringBuilder( s1 )).toString();                           

    System.out.println( s1 );
    System.out.println( s2 );
    System.out.println( s1 == s2 );
  }
}

此打印:

hello
hello
false

字符串对象的相同,但对字符串的引用不同。 equals 运算比较引用,而不是值。

Try this:

$F{LogoName}.equals( "acompanyname" )

In Java, the equality operator (==), when used on objects, checks to see if they are the same reference to the same object. This one catches all report developers without a lot of Java programming experience. You could write:

$F{LogoName} == $F{LogoName}

That would return true, as you expect, because both objects on either side of the equals operator are the same. Consider the following:

public class T { 
  public static void main( String args[] ) {                                    
    String s1 = "hello";                                                        
    String s2 = (new StringBuilder( s1 )).toString();                           

    System.out.println( s1 );
    System.out.println( s2 );
    System.out.println( s1 == s2 );
  }
}

This prints:

hello
hello
false

The values of the strings objects are the same, but the references to the strings are different. The equals operation compares the references, not the values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文