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)
Data Filter for all Data Sets within a Report
san9jay
<p>I am attempting to integrate the BIRT engine within my web application and basic integration has been successful so far.</p><p> </p><p>I would now like to implement a security wrapper around all data sets within any birt report so that I can optionally check for the existence of a specific column value in all data sets.</p><p> </p><p>I know that filtering within a report is possible, however I would like to do this at a framework level so that this security check can be applied for any BIRT report without having to change the report itself.</p><p> </p><p>For example if a BIRT report has 3 data sets that are used to display the report data.</p><p> </p><p>When executing the report within my web application I would like to check that every data set in that report returns a value X for a column SECURITY_CONTEXT.</p><p> </p><p>If either the column is missing or does not have the expected value I would throw an error.</p><p> </p><p>I would appreciate any hints on how I could achieve this.</p><p> </p><p>Thanks</p><p> </p><p>Regards</p><p>Sanjay</p><p> </p><p> </p>
Find more posts tagged with
Comments
san9jay
<p>I got this to sort of work using the following code</p><p> </p><p>...</p><p> FilterCondition filter = StructureFactory.createFilterCond();
filter.setExpr("row["SECURITY_CONTEXT"]");
filter.setOperator(DesignChoiceConstants.FILTER_OPERATOR_EQ);
//</p><p> String myMatchValue="X";
filter.setValue1("""+myMatchValue+""");</p><p> // now add the filter to all datasets on the report
ReportDesignHandle rptHandle = (ReportDesignHandle) design.getDesignHandle();
List dataSetList = rptHandle.getAllDataSets();
for (int i = 0; i < dataSetList.size(); i++) {
DataSetHandle dataset = (DataSetHandle) dataSetList.get(i);
dataset.addFilter(filter);
}</p>
san9jay
<p>I however want to have a filter to match against a list of values</p><p> </p><p>I was trying to use the FILTER_OPERATOR_IN however if I put a list of strings into the filter e.g.:</p><p> </p><p>filter.setOperator(DesignChoiceConstants.FILTER_OPERATOR_IN);</p><p> </p><p>String myMatchValue="X,Y,Z";</p><p>filter.setValue1("""+myMatchValue+""");</p><p> </p><p>That doesnt work.</p><p> </p><p>Anybody have an idea how to match multiple values?</p><p> </p><p>Basically I want an OR condition and if the SECURITY_CONTEXT column value matches X, Y or Z then the row should be displayed in the report.</p><p> </p><p>Regards</p><p>Sanjay</p>
mwilliams
Here is the structure of the multiple values xml from the design's xml source:
<list-property name="filter">
<structure>
<property name="operator">in</property>
<expression name="expr" type="javascript">row["PRODUCTLINE"]</expression>
<simple-property-list name="value1">
<value>"Motorcycles"</value>
<value>"Ships"</value>
</simple-property-list>
</structure>
</list-property>
So, you'll need to build this list property out for 'value1'.