Add row if the table row count is 0
<p>Hello,</p>
<p>I've got the report with report parameters startDate and endDate. In some cases the table may be empty(e.g. time period is too short). So in report only headers of the table are shown. I want to add a row in this empty table with message in one cell, e.g. "There is no data for this period" or something like this.</p>
<p>How can I do that?</p>
<p> </p>
<p>I tried to add condition in fetch() script like this</p>
<pre class="_prettyXprint _lang-nocode">
if (totalrows == 0) {
row["serviceName"] = "There is no data";
return(true);
}
if (currentrow >= totalrows) {
return(false);
}
var rowValue = resultInfo.get(currentrow);
row["serviceName"] = rowValue[0];
row["ogvName"] = rowValue[1];
row["ddl"] = rowValue[2];
row["avgTime"] = rowValue[3];
row["countPs"] = rowValue[4];
currentrow = currentrow + 1;
return(true);
</pre>
<p>but it doesn't work. Is any simple solution for this problem?</p>
<p>I've got the report with report parameters startDate and endDate. In some cases the table may be empty(e.g. time period is too short). So in report only headers of the table are shown. I want to add a row in this empty table with message in one cell, e.g. "There is no data for this period" or something like this.</p>
<p>How can I do that?</p>
<p> </p>
<p>I tried to add condition in fetch() script like this</p>
<pre class="_prettyXprint _lang-nocode">
if (totalrows == 0) {
row["serviceName"] = "There is no data";
return(true);
}
if (currentrow >= totalrows) {
return(false);
}
var rowValue = resultInfo.get(currentrow);
row["serviceName"] = rowValue[0];
row["ogvName"] = rowValue[1];
row["ddl"] = rowValue[2];
row["avgTime"] = rowValue[3];
row["countPs"] = rowValue[4];
currentrow = currentrow + 1;
return(true);
</pre>
<p>but it doesn't work. Is any simple solution for this problem?</p>
0
Comments
-
<p>Hi,</p>
<p> </p>
<p>I don't think that the fetch event is the right place because, if you haven't any row in your DS, you will probalbly don't have any fetch.</p>
<p> </p>
<p>The easiest way is to to test the rownum and to dynamically set the header.</p>
<p>When the DS is empty the rownum is -1</p>
<p> </p>
<p>Here is a basic example</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management