How do you add Filter to a table/list during the runtime
Options
<p>Hi, </p>
<p> </p>
<p>I need to add a Filter to a table during the runtime. </p>
<p>I am using the basic setup:</p>
<div>
<pre class="_prettyXprint">
TableHandle th = (TableHandle) DesignHandle.findElement("Table")
FilterCondition fc = StructureFactory.createFilterCond();
fc.setExpr( "row[\"something\"]" );
fc.setOperator(DesignChoiceConstants.MAP_OPERATOR_EQ);
fc.setValue1("something");
PropertyHandle ph =th.getPropertyHandle( TableHandle.FILTER_PROP );
ph.addItem( fc );</pre>
<p>However, the </p>
<pre class="_prettyXprint">
th.getPropertyHandle( TableHandle.FILTER_PROP );</pre>
<p>is returning NULL and this makes adding a Filter impossible via:</p>
<pre class="_prettyXprint">
ph.addItem( fc );</pre>
<p>I looked through the forums and the web and it looks like the TableHandle.FILTER_PROP should return something. </p>
<p> </p>
<p>Anyone knows why the Filter property handle is returning null or is the above implementation already outdated? </p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p> </p>
<p> </p>
</div>
<p> </p>
<p>I need to add a Filter to a table during the runtime. </p>
<p>I am using the basic setup:</p>
<div>
<pre class="_prettyXprint">
TableHandle th = (TableHandle) DesignHandle.findElement("Table")
FilterCondition fc = StructureFactory.createFilterCond();
fc.setExpr( "row[\"something\"]" );
fc.setOperator(DesignChoiceConstants.MAP_OPERATOR_EQ);
fc.setValue1("something");
PropertyHandle ph =th.getPropertyHandle( TableHandle.FILTER_PROP );
ph.addItem( fc );</pre>
<p>However, the </p>
<pre class="_prettyXprint">
th.getPropertyHandle( TableHandle.FILTER_PROP );</pre>
<p>is returning NULL and this makes adding a Filter impossible via:</p>
<pre class="_prettyXprint">
ph.addItem( fc );</pre>
<p>I looked through the forums and the web and it looks like the TableHandle.FILTER_PROP should return something. </p>
<p> </p>
<p>Anyone knows why the Filter property handle is returning null or is the above implementation already outdated? </p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p> </p>
<p> </p>
</div>
0
Comments
-
<p>Take a look at the attached design. It uses a data object so can be run in OpenText BIRT only. Code in beforeFactory below:</p>
<pre class="_prettyXprint">
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.elements.structures);
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
importClass(Packages.org.eclipse.birt.report.model.api.elements.DesignChoiceConstants);
if (params["Country"].value) {
var xtab = reportContext.getDesignHandle().findElement("xtab1");
addXtabFilter(xtab, "\"" + params["Country"].value + "\"", null, DesignChoiceConstants.FILTER_OPERATOR_EQ, "dataSetRow[\"COUNTRY\"]");
var tab = reportContext.getDesignHandle().findElement("table1");
addTableFilter(tab, "\"" + params["Country"].value + "\"", null, DesignChoiceConstants.FILTER_OPERATOR_EQ, "dataSetRow[\"COUNTRY\"]");
}
// Set Filter for Crosstab Object
function addXtabFilter(elemHandle,values1,values2,operator,colExpression) {
var filterhandle = elemHandle.getPropertyHandle("filter");
var ef = reportContext.getDesignHandle().getElementFactory();
var fc = ef.newFilterConditionElement();
fc.setOperator(operator);
if (values1)
fc.setValue1(values1);
if (values2)
fc.setValue2(values2);
var expression = new Expression(colExpression, ExpressionType.JAVASCRIPT);
fc.setExpressionProperty( FilterCondition.EXPR_MEMBER, expression );
filterhandle.add(fc);
}
// Add Filter to elememt (chart, table)
function addTableFilter(elemHandle,values1,values2,operator,colExpression) {
var filterhandle = elemHandle.getPropertyHandle("filter");
var fc = StructureFactory.createFilterCond();
fc.setValue1(values1);
var expression = new Expression(colExpression, ExpressionType.JAVASCRIPT);
fc.setExpressionProperty( FilterCondition.EXPR_MEMBER, expression );
fc.setOperator(operator);
if (values2 != null)
fc.setValue2(values2);
filterhandle.addItem(fc);
</pre>
<div>}</div>
<div> </div>
0 -
<p>Attached is a version using OS BIRT and Classic Models</p>
0
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 122 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management