显示“无数据" BIRT报表中的表为空时出现的消息 [英] Display "No Data" message when table is empty in BIRT Report

查看:375
本文介绍了显示“无数据" BIRT报表中的表为空时出现的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果查询不返回任何数据,我想隐藏一个表并报告没有数据"消息. 在计算列中,我添加了对存在的行数进行计数的列(即TableCheck). 并且我在表下方创建了带有无数据"消息的标签.在脚本onCreate中,我添加了以下代码.

I want to hide a table and to report that "No Data" message is present if the query returns no data. In computed columns i have added the columns which counts the number of rows present(i.e.TableCheck). and i have created label just below the table with the message "No Data". In script onCreate i have added the below code.

if( countOfRows == 0 ){
this.getStyle().fontStyle = "italic";
this.getStyle().fontSize = "large";
}else{
this.text = "";
}

countOfRows = 0在脚本中初始化.

countOfRows = 0 is initialize in script.

在表可见性属性中,检查隐藏元素"并在表达式中添加以下代码.

In table visibilty propery, checked the Hide Element and added the below code in expression.

if (row["TableCheck"] == null){
    true
}
else{
    false
}

问题:当dataSet为空时,显示"No Data"消息.但是,当dataset不为空时,则错误消息没有隐藏.

Problem: When dataSet is empty "No Data" Message is displaying.But when data set is not empty, then error message is not hiding.

请让我知道如何解决此问题.

Please let me know how to fix this.

预先感谢.

推荐答案

以这种方式执行: 首先添加视觉元素以在数据集不返回任何行时显示它.

Do it this way: First add visual elements to display it when data set doesn't return any row.

然后在报表根目录的Initialize脚本中定义全局变量. 例如

Then define global variable in Initialize script of report root. For example

rowsReturned = 0;

在您要评估数据集的表上,查看在可见性"选项卡上是否设置了返回的行:

On your table that you'll evaluate data set to see is there rows returned on Visibility tab set next:

在您希望在没有返回数据的情况下显示的元素上,在可见性"选项卡上对此进行设置

On elements you want to display whene there is no returned data set this on Visibility tab

这篇关于显示“无数据" BIRT报表中的表为空时出现的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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