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)
changing data set using a parameter
Ben Sztucki
<p>Hi Guys, </p>
<p> </p>
<p>I was wondering if there was a way to dynamically what data set is chosen to populate a chart/ table using a parameter. Is this possible?</p>
<p> </p>
<p>Thanks in Advance, </p>
<p> </p>
<p>Ben
</p>
Find more posts tagged with
Comments
wwilliams
<p>I don't know if this will be helpful.</p>
<p>I have done something like this in my initialize method to choose which dataset to use</p>
<pre class="_prettyXprint">
if(params["mySite"].value == "XXXX"){
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("other").drop();
} else {
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("main").drop();
}
</pre>
<p>But I also used separate tables</p>
micajblock
<p>Do not use initialize, but use the beforeFactory. The idea is right. If you drop a chart or table the data set associated with it will not be executed, so the the easier way to accomplish this is just to drop the table/chart that you do not need. There is an example in this DevShare. Look at the beforeFactory of Report1.</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/465-highly-parameterized-chart-and-table/'>http://developer.actuate.com/community/forum/index.php?/files/file/465-highly-parameterized-chart-and-table/</a></p>
;
wwilliams
<p>Doh!, yea we don't need it to execute twice..me bad!</p>
linucksrox
<p>The way I've handled this is to dynamically generate SQL based on parameters, even to the point of having two SQL blocks in one dataset, and determining which block to comment out depending on the parameters. Normally I use the beforeOpen method on the dataset, and use a parameter convention of SQL parameters in square brackets within single quotes:</p>
<pre class="_prettyXprint _lang-sql">
SELECT
table.field
FROM table
WHERE table.field BETWEEN ('[startParameter]' AND '[endParameter]') </pre>
<p>Then with javascript I can replace [startParameter] and [endParameter] with the value of a parameter.</p>
<p>I also use this to maximize query efficiency by commenting out JOINS by default, but enabling them when required by the parameters.</p>
<p>I like this solution better because then you don't have to maintain multiple copies of the same chart or table on the layout. What if you need to adjust the margins, add a column, etc?</p>
<p> </p>
<p>On the other hand, dropping a report element is new to me, as I've been conditionally hiding report elements but apparently still running the datasets in the background.</p>