Display “No Data” message when table is empty in BIRT Report

偶尔善良 提交于 2019-11-29 08:27:05

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

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

kelgwiin

If you want to hide the table when no data returned, you can write this in its Visibility property:

row.__rownum < 0

and in Visibility property of your "No Data" message you use the opposite check:

row.__rownum >= 0

Note that both components must be bound to the data set you want to check. In the case of the message component you can achieve this putting it in a header or footer row.

Alternative solution without using global variables (though functionally not quite the same, because the layout will always contain a table):

Add a binding numRows for the COUNT aggregate with the expression 1 to the table.

Set as visibility expression on the table header row:

!row["numRows"]

Add a new footer row to the table; for this footer row set the visibility expression

row["numRows"]

Merge the cells in this footer row, then place a label "No data found" into the table cell.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!