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)
Dropping orphan datasets in BIRT report
BIRT User
<p>Hi,</p>
<p>I am using Actuate iHub BRDPro and i have to drop the unused datasets before report generation.</p>
<p> </p>
<p>I want to drop the datasets which are not binded with any of the report elements. I have to drop it in onPrepare() or beforeFactory() methods.</p>
<p> </p>
<p>Is there a way to find whether dataset is being binded with any report elements or not?.</p>
<p> </p>
<p> </p>
<p> </p>
<p>Thanks,</p>
<p>Ragu</p>
Find more posts tagged with
Comments
micajblock
<p>Data sets that are not being used do not executed. Why do you want to drop the data sets?</p>
BIRT User
<p>We are generating report using multiple libraries and we are saving that generated report using SaveAs option in BRDPro.</p>
<p>
In the SaveAs report, each elements from different library is having its own dataset and its own datasource.<br>
</p>
<p>Based on input parameter,if we want to add a new report, its adding a new element, new dataset and new datasource in the SaveAs report.</p>
<p>But if we don't need any element we are dropping that element. Currently its droppinng that element only and not its associated datasets/datasources.</p>
<p>
In the final report, many datasets and datasources are there which are not used in the report.</p>
<p> </p>
<p>It would be great if you could help me to find the unused datasets in the report.</p>
<p> </p>
<p>Thanks,</p>
<p>Ragu</p>
micajblock
<p>Sorry, I do not know. Maybe some other experts do. </p>
RichT
<p>Hello,</p>
<p> </p>
<p>In a report I developed in BIRT 2.6.2 I was dropping a dataset in the BeforeFactory() like this:</p>
<pre class="_prettyXprint _lang-js">
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("MyDataset").drop();
</pre>
<p>I'm not familiar with the differences between BIRT 2.6.2 and Actuate iHub BRDPro so this may not be too much help. Further, I'm not sure how to verify that a dataset has no associated elements.</p>
<p> </p>
<p>Hopefully this helps you with part of your problem,</p>
<p>Rich</p>
Matthew L.
<p>It is more complex to clean up than it is to add in dynamically.</p>
<p>Perhaps you could create an example of what you are wanting to accomplish and we could find a better alternative.</p>
<p> </p>
<p>However if you are wanting to do some clean up, as long as you know the elements you are wanting to clean up, this will make it slightly easier.</p>
<p>For example, to clean up a table from a report design called "MyTable" you could do the following, this is assuming that other elements are not dependent on the Table as well:</p>
<pre class="_prettyXprint _lang-js">
tableName = "MyTable";
reportDesignHandle = reportContext.getReportRunnable().designHandle.getDesignHandle(); //Get ReportDesignHandle
tableHandle = reportDesignHandle.findElement(tableName); //Get TableHandle
tableDataSetName = tableHandle.getProperty("dataSet"); //Get Data Set name
tableHandle.drop(); //Drop Table
odaDataSetHandle = reportDesignHandle.findDataSet(tableDataSetName); //Get OdaDataSetHandle
dataSourceName = odaDataSetHandle.getProperty("dataSource"); //Get Data Source name
iterator = odaDataSetHandle.clientsIterator(); //Check to see if any other elements are using the same Data Set
while (iterator.hasNext()) //Loop
var value = iterator.next(); //Get next value
if(!value)
odaDataSetHandle.drop(); //Drop Data Set
odaDataSourceHandle = reportDesignHandle.findDataSource(dataSourceName); //Get OdaDataSourceHandle
iterator = odaDataSourceHandle.clientsIterator(); //Check to see if any other Data Sets are using the same Data Source
while (iterator.hasNext()) //Loop
var value = iterator.next(); //Get next value
if(!value)
odaDataSourceHandle.drop(); //Drop Data Source
</pre>
BIRT User
<p>Thanks Matthew!!</p>
<p> </p>
<p><span>clientsIterator</span><span>() </span>is the method which i am looking for. If this method gives the associated elements of the dataset, i can do something like this.</p>
<p> </p>
<p>dataSetHandle = reportContext.getDesignHandle().getDataSets(); //get the datasets handle</p>
<p>dataSetsIterator = dataSetHandle.iterator(); //get the datasets slot iterator</p>
<p>//Iterate through the datasets</p>
<p><b>while</b> (dataSetsIterator.hasNext())</p>
<p>{</p>
<p>odaDataSetHandle= dataSetsIterator.next();</p>
<p>iterator <span>=</span><span> odaDataSetHandle</span><span>.</span><span>clientsIterator</span><span>();</span><span> </span><span>//Check to see if any other elements are using the same Data Set</span><br><span>while</span><span> </span><span>(</span><span>iterator</span><span>.</span><span>hasNext</span><span>())</span><span> </span><span>//Loop</span><br><span>var</span><span> value </span><span>=</span><span> iterator</span><span>.</span><span>next</span><span>();</span><span> </span><span>//Get next value</span><br><span>if</span><span>(!</span><span>value</span><span>)</span><br><span>odaDataSetHandle</span><span>.</span><span>drop</span><span>();</span><span> </span><span>//Drop Data Set</span><br><br>
}</p>
<p> </p>
<p>I hope this will resolve my issue. I will implement this and come back if i encounter any issues.</p>
<p> </p>
<p> </p>
<p>Thanks,</p>
<p>Ragu</p>