Telos Posted May 27, 2009 Share Posted May 27, 2009 Is there a way to reference a property of one report element in the printWhen expression of another? In particular, I want to not have a page break if a certain subreport is blank (the subreport is composed of several elements each with their own printWhen expressions, and I do not want to duplicate all of that logic in one compound statement just for the sake of the page break) Link to comment Share on other sites More sharing options...
blaguman Posted May 28, 2009 Share Posted May 28, 2009 Hi Telos, I think you can make your subreport to return a value. Maybe you could try that way ? Link to comment Share on other sites More sharing options...
Telos Posted May 28, 2009 Author Share Posted May 28, 2009 That's an interesting idea. Is it possible to return a value that is calculated by Jasper itself (e.g. the height of a band when it is rendered?). If I need to re-evaluate all of the values that control the printWhen expressions for the sub-elements just so I can produce my own return value, then I'm essentially in the same place as I started. Link to comment Share on other sites More sharing options...
rosy73 Posted May 28, 2009 Share Posted May 28, 2009 I resolved the problem in this way: in the master report create a group band put in the group header a Page Break and the subreport the Page Break.PrintWhen Espression = ($F{createdBy6}==null ? Boolean.FALSE : Boolean.TRUE ) The field $F{createdBy6}ByeCode:groupHeader> <band height="50" isSplitAllowed="false"> <subreport> <reportElement positionType="Float" x="1" y="24" width="555" height="15" isRemoveLineWhenBlank="true"/> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/folder/esameneurologico")]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "st_cartella_completa_esameneurologico1.jasper"]]></subreportExpression> </subreport> <break> <reportElement x="0" y="3" width="100" height="1" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" printWhenGroupChanges="esneuro"> <printWhenExpression><![CDATA[($F{createdBy3}==null ? Boolean.FALSE : Boolean.TRUE )]]></printWhenExpression> </reportElement> </break> </band> </groupHeader> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now