Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
problem with getting an element properties in another element
yaragallamurali
<p>Hi I have a table element and text element in my birt template. I am trying to set the tables display property to 'none' in the textElements expression builder in the following way</p>
<pre class="_prettyXprint _lang-">
reportContext.getDesignHandle().getElementByID(927).getStyle()
</pre>
<p>i am able to get TableHandle object but when i call getStyle() on it it returns null. so how can i set the tables display property to none out side the table element?</p>
Find more posts tagged with
Comments
Clement Wong
<p>IDs will change. You should name your table, and use <em>findElement</em>(name) instead of <span><em>getElementByID </em>(#).</span></p>
<p> </p>
<p>This will set the table's Display to No Display.</p>
<p><span style="font-family:'courier new', courier, monospace;">reportContext.getDesignHandle().findElement("mytable").setProperty( "display", "none");</span></p>
<p> </p>
<p>You won't be able to call this in the expression builder of the Text Report Item because it will be too late.</p>
<p> </p>
<p>What high level requirement are you trying to solve? There might be alternatives.</p>
yaragallamurali
<p>I have two tables in my report. One inside the other tables detail row. When there is no data in the internal table i need to hide external and internal table. This is my requirement.</p>
yaragallamurali
<p>anybody have an idea?</p>
<p> </p>
<p>Actually what i am doing is when inner tables detail row's onrender event i am trying to set a global persistent variable. and in the report "page start" event based on the global variable i am trying to hide the extenal and internal table. is this approach right? IF not what is the right approach? i am using pogo dataset.</p>
Clement Wong
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/user/3879-mwilliams/'>Michael
Williams</a> had provided a solution in a previous thread to hide the inner table
@<
;/p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/24253-hide-outer-tables-row-based-on-variable-set-by-sub-table/?p=92046'>http://developer.actuate.com/community/forum/index.php?/topic/24253-hide-outer-tables-row-based-on-variable-set-by-sub-table/?p=92046</a></p>
;
<p> </p>
<p>If you want to see it run on a later version, you'll need to go into the inner table's binding and set an expression. It cannot be blank. Attached is an updated version for reference. It was tested on OS BIRT 4.5.0 and iHub 3.1.</p>
<p> </p>
<p> </p>
<p>Now, the same technique can be applied to the outer table. Attached is an example where on the first page the customer (#125) has no payments and is displayed -- no modifications. The second page has the hide inner and outer table logic in the onRender event, and the tables are not displayed.</p>
<p> </p>
<p> </p>
yaragallamurali
<p>hi i am looking into the following rpt design. in this in the inner table a global variable is set in "oncreate" of the inner table but the logic to hide the table is written in on render event of the external tables detail row. so the problem is external tables on render is being called first and then the oncreate of the inner table is being called. so the external is invisible whether there is data in the inner table or not. Kindly help </p>
<ul><li><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?app=core&module=attach§ion=attach&attach_id=12877'
title="Download attachment"><img src="
http://developer.actuate.com/community/forum/public/style_extra/mime_types/unknown.gif"
; alt="unknown.gif"></a> <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?app=core&module=attach§ion=attach&attach_id=12877'
title="Download attachment"><strong>HideOuterTableBasedOnInnerTable.rptdesign</strong></a> <span style="font-size:12px;color:rgb(119,119,119);"><strong>32.08KB</strong></span> <span style="font-size:12px;color:rgb(164,164,164);">0 downloads</span></li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
wwilliams
<p>Do you need two tables? Won't a join allow you to (in your design example above) to hide or show based on the existence of rows?</p>
yaragallamurali
<p>yes sir. do to some reason we have two tables. i need to find a solution to hide the external table when no results in inner table.</p>
PaulCooper
<p>I have applied a method we use at work to get a list of ids to build a hyperlink.</p>
<p> </p>
<p>The method is to have hidden table using the inner table's Data Set which stores the count of records per customer number into a JavaScript associative array (a JS Object). As the outer table's Data Set has a different number of customers as the inner table I used another hidden table based on the outer table's Data Set to total up the count from that array for the customers in that outer Data Set.</p>
<p> </p>
<p>These hidden tables are place above the displayed table so the array and grand total is populated before BIRT processes the displayed parts of the report.</p>
<p> </p>
<p>To use the created array and total I have set the outer table's data row to be hidden if the array entry for that customer does not exist and the whole table is hidden if the grand total is zero.</p>
<p> </p>
<p>FYI the JavaScript code is found in the initialize script and the onCreate scripts of the Data Items in the hidden tables.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>Paul Cooper</p>
<p> </p>
<p>