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)
Adding a dynamic filter to a data set
AlexAD
Hello.<br />
<br />
I need to filter a data set based on the parameter passed, i.e. apply a filter to a data set at runtime. I found a way to apply a filter to a data set by adding this code in dataSet.beforOpen() method:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var filter = new org.eclipse.birt.report.model.api.elements.structures.FilterCondition();
filter.setExpr("row['CUSTOMERNAME']");
filter.setOperator("eq");
filter.setValue1("'Atelier graphique'");
reportContext.getDesignHandle().findDataSet("Data Set").addFilter(filter);
</pre>
This code adds a filter to a design rather than to a runtime data set object and that's not what I really need. It adds the same filter every time a data set opens which is not good and most significantly it doesn't work in some cases.<br />
I.e. I tested it on a single data set and it worked fine, but after I added a chart it stopped working ...<br />
<br />
Could you please help me with this problem.<br />
<br />
Thank you in advance.
Find more posts tagged with
Comments
AlexAD
Problem was solved as I added that code into beforeFactory() method on the design.
Thanks to guys who shared their solution on the Internet and thanks to Google to have helped to find me that
And of course many thanks to me for patience and not giving up
mwilliams
Ha! Glad you found the solution to your issue! Let us know whenever you have questions! Maybe next time someone in the community will get to it before your Google search skills do.
AlexAD
Thanks, Michael.
So it turns out that I cannot change the design of a data set object in the beforeOpen() event on that data set. Am I correct? Does anyone have an idea why?
Thanks.