Hide a column when value is 0 which uses page break
<p>Hi,</p>
<p> </p>
<p> I have one report in which one column A is splitted by column B.I need to hide a column A when no data.I tried visibility functionality & it hided column A for all spliting of column B.Column A is a aggregated field.</p>
<p> </p>
<div>
<p>For Eg, I need to hide "column 2" in that rows having no data.</p>
<p> </p>
<p><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">1</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">2</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">3</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">4</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 10 13 15</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 23 13 19</span></p>
<p> </p>
<div>At the same time,I need to show "Column 2" when there is data</div>
<div>
<p> </p>
<p><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">1</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">2</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">3</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">4</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 15 36 5</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);">2 71 53 9</span></p>
</div>
</div>
<p> </p>
<p> </p>
<p>Regards,</p>
<p>Emy</p>
<p> </p>
<p> I have one report in which one column A is splitted by column B.I need to hide a column A when no data.I tried visibility functionality & it hided column A for all spliting of column B.Column A is a aggregated field.</p>
<p> </p>
<div>
<p>For Eg, I need to hide "column 2" in that rows having no data.</p>
<p> </p>
<p><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">1</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">2</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">3</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">4</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 10 13 15</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 23 13 19</span></p>
<p> </p>
<div>At the same time,I need to show "Column 2" when there is data</div>
<div>
<p> </p>
<p><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">1</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">2</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">3</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(0,0,139);">Column</span><span style="margin:0px;color:rgb(0,0,0);"> </span><span style="margin:0px;color:rgb(128,0,0);">4</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);"> 15 36 5</span></p>
<p><span style="margin:0px;color:rgb(128,0,0);">2 71 53 9</span></p>
</div>
</div>
<p> </p>
<p> </p>
<p>Regards,</p>
<p>Emy</p>
0
Comments
-
<p>Hi Emy,</p>
<p> </p>
<p>To hide a column in a table component, you can add this script to your report on the <strong>onPrepare </strong>Event of the table</p>
<p> </p>
<p><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">if</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> (<my condition></span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">){</span></span></span></p>
<p> <strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.getColumn(1).getStyle().display = </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"none"</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">;</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">}</span></span></span></p>
<p> </p>
<p> </p>
<p>Your condition can be for instance the count of not null value of the column 2. If this value is 0 (= only null or no value), you hide the column</p>Warning No formatter is installed for the format ipb0 -
<p>Emy,</p>
<p> </p>
<p>Your sample design referenced an XLS which did not exist. However, it was easy to recreate with sample data.</p>
<p> </p>
<p>The easiest way to hide a column based on the data you provided is the following:</p>
<p> </p>
<p>1. Create a Computed Column (in my example it's called "Column B COUNT")</p>
<p> A. Change the Data Type to Integer</p>
<p> B. Set the Aggregation to COUNT</p>
<p> C. Set the Expression to Column B</p>
<p> </p>
<p>2. Select Column B in the Layout</p>
<p> </p>
<p>3. Check the Hide Element option under Properties > Visibility</p>
<p> </p>
<p>4. Change the Expression from "true" to:</p>
<pre class="_prettyXprint">
if (row["Column B COUNT"] == 0)
true;
else
false;</pre>
<p>In the sample design, I changed Column B's background color to red to highlight so that you can see that it's working.</p>
<p> </p>
<p>If you change the underlying data and add a single value in Column B, then Column B will appear in the output.</p>
Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 104 General Questions
- 141 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management