Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Preventing Tables from Populating
Lianite
Greetings,
I have a report with multiple tables in it, and all but one of the tables are hidden based upon which parameters are selected when running the report. However all the tables still populate which takes an extraordinarily large quantity of memory and time to process.
I recently attended a BIRT Roadshow and it was suggested to me that I use JavaScript in the onPrepare phase of each table in order to prevent them from populating.
My question is what would I have to use for JavaScript in order to prevent the tables from populating?
Reminder, merely hiding the tables with visibility is not an option, and neither is segmenting the tables out into separate reports.
Thanks in advance,
Jordan
Find more posts tagged with
Comments
mwilliams
Hi Jordan,
Rather than just hiding the tables based on the parameter value, you could "drop" the table from the report based on the parameter value. This would prevent the table from ever processing.
Hope this helps.
Lianite
Hi Michael,
Thats a good idea, but how would I implement that?
Thanks,
Jordan
mwilliams
Jordan,<br />
<br />
If you had a parameter called "table", with choices Table1, Table2, and Table3 for which table the user wanted to see. You would name your tables the above names and you could put the following in the beforeFactory event of your report:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (params["table"] == "Table1"){
table2 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table2");
table2.drop();
table3 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table3");
table3.drop();
}
else if (params["table"] == "Table2"){
table1 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table1");
table1.drop();
table3 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table3");
table3.drop();
}
else{
table1 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table1");
table1.drop();
table2 = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table2");
table2.drop();
}
</pre>
<br />
Let me know if you have questions.
Happy
Another method might be to do the following:<br />
Loop through each element, check whether you have a table, and then check the name of the table.<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportBody = reportContext.getReportRunnable().designHandle.getDesignHandle().getBody();
for (bodyIDX=0;bodyIDX < reportBody.getCount();bodyIDX++)
{
reportElement = reportBody.get(bodyIDX);
reportElementClass = reportElement.getClass();
if (reportElementClass.getSimpleName() == "TableHandle") //
{
if (reportElement.getName() == params["DATASET"].value)
{
mytable = reportElement;
} else
{
reportElement.drop();
bodyIDX=0;
}
}
}
</pre>
Lianite
I just finished implementing Micheal's suggestion which worked flawlessly.
Thank Micheal.
Jordan
mwilliams
Jordan,
No problem. Let us know whenever you've got questions.