在BIRT中隐藏网格/表,没有数据源的结果 [英] Hiding grids/tables in BIRT whith no results from datasource

查看:341
本文介绍了在BIRT中隐藏网格/表,没有数据源的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



问题是这样的:我正在从jdbc数据源生成一个报表。我从DB中选择项目,以便有一行或一行。如果返回一行,我将显示反映结果的数据。如果没有行返回,我应该隐藏数据应该显示的整个网格,并显示一个简单的消息,没有数据可以找到。



我已经尝试过不同的操作,例如向查询添加计数和从插件计算的计数,但是如果没有给出结果,那么没有计数值。我还尝试创建一个默认为true的布尔参数showHideData,如果其中一个关键字段为空,则showHideData设置为false。这看起来像这样(我把它放在数据集中关闭脚本选项):

  if(row [FIRM]!= null){
params [showHideData] = true;
} else {
params [showHideData] = false;
}

这不幸给我一个javascript错误,说它无法访问空值。我不知道该怎么做,因为我不太懂Javascript,但是我会感谢你给予的任何帮助。

解决方案

p>您可以使用属性编辑器中的visibilty选项卡来执行此操作。


  1. 在数据表(或包含它的网格,如果你想要的话)隐藏整个网格)转到绑定选项卡。

  2. 添加一个功能COUNT的聚合,并为表达式选择一个数据集字段。

  3. 转到properties-> Visibilty选项卡并勾选隐藏元素,并在表达式中将行[聚合] == 0 替换为必要的聚合名称。

  4. 创建一个1x1网格

  5. 将网格与数据集相关联,并添加与上述相同的聚合。

  6. 在可见性选项卡上单击再次使用隐藏元素,但是这次使用 row [Aggregation]!= 0


I am having trouble altering a report in birt to meet my teams specifications.

The problem is this: I am generating a report from a jdbc datasource. I am selecting items from the DB such that there is either one row or none. If there is a row returned, I show data reflecting the results. If there is no row returned though, I should hide the entire grid that the data should have been shown in and show a simple message, "no data can be found."

I have tried different actions like adding a count to the query and the computed count from the plugin, but if no results are given then there is no count to go off of. I have also tried creating a boolean parameter showHideData that is defaulted to true and if one of the key fields is null, then showHideData is set to false. This looked as such (I placed it in the datasets afterClose script option):

    if(row["FIRM"] != null){
        params["showHideData"] = true;
    }else {
        params["showHideData"] = false;
    }

This unfortunately gives me a javascript error saying that it cannot access the null value. I am not sure how to do this because I am not well versed in Javascript, but I would appreciate any help you could give.

解决方案

You can do this using the visibilty tab on the property editor.

  1. On you data table (or the grid containing it if you want to hide the whole grid) go to binding tab.
  2. Add an aggregation with function "COUNT" and select one of the data set fields for the expression.
  3. Go to the properties->Visibilty tab and tick "Hide Element" and in the expression put row["Aggregation"] == 0 replacing the aggregation name if necessary.
  4. Create a 1x1 grid containing a "No data present" label.
  5. Associate the grid with the data set and add the same aggregation as above.
  6. On the Visibility tab click "Hide Element" again, but using row["Aggregation"] != 0 this time.

这篇关于在BIRT中隐藏网格/表,没有数据源的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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