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 puted 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.
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 puted 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.
Share Improve this question asked Jul 31, 2012 at 13:59 user1565916user1565916 211 gold badge1 silver badge2 bronze badges 1- Related Display “No Data” message when table is empty in BIRT Report – bluish Commented Jul 8, 2015 at 8:31
1 Answer
Reset to default 14You can do this using the visibilty tab on the property editor.
- On you data table (or the grid containing it if you want to hide the whole grid) go to binding tab.
- Add an aggregation with function "COUNT" and select one of the data set fields for the expression.
- Go to the properties->Visibilty tab and tick "Hide Element" and in the expression put row["Aggregation"] == 0 replacing the aggregation name if necessary.
- Create a 1x1 grid containing a "No data present" label.
- Associate the grid with the data set and add the same aggregation as above.
- On the Visibility tab click "Hide Element" again, but using row["Aggregation"] != 0 this time.