I'm working with jasper reports, supplying data through the JRMapCollectionDataSource
. To be specific, each row is smth like this:
{"id"->"21552", "name"->"", "date"->"22.03.2013"}
Now I need to include to the report only those records, where id
is greater t开发者_如何转开发han 10, for instance. What shall I do?
I've discovered filterexpression
tag, but it only works with subdata sets. Then, how I can apply it to the main dataset?
When I'm trying to put filterexpression
inside the jasperReport
tag, iReports fails with error:
thanks a lot for your response, I've tried to do so. I report gives me
exception:org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'property'. One of '{"http://jasperreports.sourceforge.net/jasperreports":group, "http://jasperreports.sourceforge.net/jasperreports":background, "http://jasperreports.sourceforge.net/jasperreports":title, "http://jasperreports.sourceforge.net/jasperreports":pageHeader, "http://jasperreports.sourceforge.net/jasperreports":columnHeader, "http://jasperreports.sourceforge.net/jasperreports":detail, "http://jasperreports.sourceforge.net/jasperreports":columnFooter, "http://jasperreports.sourceforge.net/jasperreports":pageFooter, "http://jasperreports.sourceforge.net/jasperreports":lastPageFooter, "http://jasperreports.sourceforge.net/jasperreports":summary, "http://jasperreports.sourceforge.net/jasperreports":noData}' is expected.
Filter expressions are not limited to sub-datasets. Simply put the filterExpression
tag inside the jasperReport
tag and it will be applied to the main dataset.
Placement is important, it seems. The filter expression must come before any content, but after the fields are declared.
精彩评论