jaapandre Posted August 17, 2010 Share Posted August 17, 2010 I'm a newbie concerning jasper reports and java :-( But JasperReports (and java) sounds promissing so I'm trying to generate a report using ireport (3.7.2) with crosstabs. In the database I have row_id and row_text. In the crosstab I want to use both these fieldsI use $F{row_id} for the bucket expression for the 'row groups' which creates $V{row_id} and I think I need to use 'Measures' to be able to use the row_text. Unfortunately I didn't succeed to create this measure. I tried:name: row_textmeasure class: java.lang.stringvalue expression: $F{row_text}Calculation: first But if I use this variable in the report it returns 'null'.I hope somebody could help. Jaap-Andre, there doesn't exist stupid questions, only stupid questioners Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 18, 2010 Share Posted August 18, 2010 Hi, Can you attach here a simple JRXML file showing your problem? Thanks,Teodor Link to comment Share on other sites More sharing options...
jaapandre Posted August 18, 2010 Author Share Posted August 18, 2010 Thanks for your reaction.Below you find some parts of the jrxml, which (I think) are relevant. <field name="row_id" class="java.lang.String"/> <field name="row_text" class="java.lang.String"/> <field name="col" class="java.lang.String"/> <field name="title_row" class="java.lang.String"/> <field name="title_col" class="java.lang.String"/> <field name="val" class="java.lang.String"/> <measure name="row_text" class="java.lang.String" calculation="First"> <measureExpression><![CDATA[$F{row_text}]]></measureExpression> </measure> <rowGroup name="row" width="258" totalPosition="End"> <bucket> <bucketExpression class="java.lang.String"><![CDATA[$F{row_id}]]></bucketExpression> </bucket> <crosstabRowHeader> <cellContents mode="Opaque"> <box leftPadding="0"> </box> <textField isStretchWithOverflow="true"> <reportElement style="Crosstab Data Text" x="0" y="0" width="258" height="15"/> <box> </box> <textFieldExpression class="java.lang.String"><![CDATA[$V{row}+": "+$V{row_text}]]></textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents mode="Opaque"> <box rightPadding="0"> </box> </cellContents> </crosstabTotalRowHeader> </rowGroup> Link to comment Share on other sites More sharing options...
jaapandre Posted August 18, 2010 Author Share Posted August 18, 2010 Ah well.I tried to use a measure in the crosstabRowHeader, but that seems not possible... But I'm able to use it in a crosstabcell.Fortunately that's the place that I use it. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 19, 2010 Share Posted August 19, 2010 Hi, Just to bring some closure to this and confirm that you indeed need to create an additional bucket for the row_text field, regardless if it actually breaks the same way as the row_id bucket. This is the only way to make that row_text value appear correctly in a row header. I hope this helps.Teodor 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