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)
Run Report by selecting Data Set Dynamically
chetan_1981
<p>Hi,</p>
<p> </p>
<p>I have two Datasets and one table in a BIRT Report.</p>
<p> </p>
<p>I want the table to display values of a particular dataset based upon a parameter value at runtime or dynamically.</p>
<p> </p>
<p>For Data Set 1 : Parameter will be today's date - 1 Day</p>
<p> </p>
<p>For Data Set 2 : Parameter will be today's date</p>
<p> </p>
<p>i.e. Report will use dataset 1 and dataset 2 on alternate day.</p>
<p> </p>
<p>Both Datasets have same number of columns and column names are also same in both dataset.</p>
<p> </p>
<p>Please help. How this could be done?</p>
Find more posts tagged with
Comments
micajblock
<p>Easier just to create 2 tables and drop the one you don't want. If the table is dropped the data set will not be executed. Example can be found here - <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1069-simple-example-of-dropping-a-tablechart/'>http://developer.actuate.com/community/forum/index.php?/files/file/1069-simple-example-of-dropping-a-tablechart/</a></p>
;
sureshpulapalli
<p>Chetan,</p>
<p> </p>
<p>I hope this code will help you to switch the data set. I added this code in initialize method of the report</p>
<p> </p>
<div>myTable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement( "sampleTable");</div>
<div>if( params["ds"].value == "1" ){</div>
<div>myTable.setProperty( "dataSet", "Data Set1" );</div>
<div>}else{</div>
<div>myTable.setProperty( "dataSet", "Data Set2" );</div>
<div>}</div>
<div> </div>
<div> </div>
<div>sampleTable-- this is the table name</div>
chetan_1981
<p>Thanks Mika and Suresh for immediate help</p>
Migrateduser
<p>Hi,</p>
<p> </p>
<p>I am having a parameter of data type string and want to pass system date as a parameter value (of params["FromDate"]) in the following script,</p>
<p> </p>
<div>var oTable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table1");</div>
<div>var cTable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table2");</div>
<div> </div>
<div>if(params["FromDate"].value == <span style="color:#ff0000;"><strong>"System Date</strong>"</span>)</div>
<div>{</div>
<div>cTable.drop();</div>
<div>}else {</div>
<div>oTable.drop();</div>
<div>}</div>
<div> </div>
<div>Also I want one day before date of the parameter.</div>
<div>How this can be done?</div>