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)
If a chart is set to invisible, does the underlying dataset still pull data?
kevinshih
I have a chart that is conditionally set to invisible. If the condition is true, does the dataset bound to the chart still try to get data from the database? Or is Birt smart enough to ignore any work it has to do if the object is invisible?
Thanks!
Find more posts tagged with
Comments
mwilliams
Hi kevinshih,
Based off of a quick test I did incrementing a variable in the onFetch method of the dataSet, with only a hidden chart in my report design besides a dynamic text element that is not bound to a dataSet that displays the variable's value, yes, the dataSet is still fetched when the chart is invisible.
I checked this in 2.3.2.
kevinshih
Thanks for the quick response Michael!
Is there a way to tell Birt not to pull the dataset then?
mwilliams
kevinshih,
How do you determine whether the chart is hidden or not?
kevinshih
I have a report parameter that is set to allow multiple values. If a single value is passed in, I show one chart. If multiple values are passed in then I show a different chart.
In the visibility property expression builder, I have:
var resourceCount = params["rpReportParam"].value.length
if( resourceCount > 0 ) {
true
}
else {
false
}
mwilliams
kevinshih,
In that case, you might be able to drop the chart with something like the following in your beforeFactory script, rather than just hiding it.
if (params["paramName"] == condition){
//don't forget to name chart
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("chartName").drop();
}
This works for dropping a table. I would assume it works for charts as well. Let me know.
kevinshih
Thanks Michael. I will try it and let you know.
Would you mind sending me the script you used for setting the variable on the onFetch script for the dataset? I'd like to confirm that the dataset is not getting pulled after dropping the chart.
Thanks again,
Kevin
mwilliams
kevinshih,
All I did to check the onFetch method was to define a variable in the initialize script of the report, 'DSCheck = 0;'. Then, in the onFetch method of the dataSet, put, 'DSCheck++;'. Then, to view the value of DSCheck, you just need to put a dynamic text box after the chart in the report with the expression 'DSCheck;'.
kevinshih
The drop() method worked perfectly. Thanks!
mwilliams
kevinshih,
No problem. Glad to help. Let us know whenever you have questions.