如何避免jasper报告中的空值 [英] How to avoid null values in jasper reports

查看:581
本文介绍了如何避免jasper报告中的空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的jasper报告中有一个字段,其表达式值类似于

I have a field in my jasper report which has a expression value like

$F{address_street1}+" "+$F{address_street2}+ " " +$F{address_state} + " "+$F{address_country}+ " "+$F{address_zip}

我的问题是,如果此处的任何字段为null,我会在其他内容之间获得空值,例如

My problem is that if any of the fields in here is null I get the null value between other things like

101 Main St****null****ILUnited States12345 

注意突出显示的null。我有什么方法可以避免这种情况吗?

Notice the highlighted null. Is there any way I can avoid that?

我尝试使用布尔表达式检查其中特定字段的空值并将其替换为空白,但这并不是似乎工作。

I have tried checking the null value for a particular field in it using boolean expression and replacing it with blank, but that doesn't seem to work.

推荐答案

将属性 isBlankWhenNull 设置为true。

Set the property isBlankWhenNull to true.


  • 在iReport中,选中字段后选中Blank When Null复选框。

  • 在jasper jrxml中file:< textField isBlankWhenNull =true>

  • In iReport check the Blank When Null checkbox when your field is selected.
  • In jasper jrxml file: <textField isBlankWhenNull="true">

这篇关于如何避免jasper报告中的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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