beard9982 Posted September 21, 2012 Share Posted September 21, 2012 I have a cross tab, nice and simpleRow Group Company NameColumn Groups user_nameMeasures $F{conformance_tasks_estimated_hours}I also have a variable that is returning from a sub report $V{TotalHrsAvailable}I get a nice crosstab showing Per user the ammount of development hrs assigned to each company I would like to add a new column into the crosstab to show the number of hrs as a % against the$V{TotalHrsAvailable} **********************************************************************************************************************************************************************************<summary> <band height="95" splitType="Stretch"> <crosstab> <reportElement x="0" y="0" width="595" height="95"/> <rowGroup name="companies_name" width="70" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$F{companies_name}]]></bucketExpression> </bucket> <crosstabRowHeader> <cellContents backcolor="#F0F8FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{companies_name}]]></textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <staticText> <reportElement x="0" y="0" width="70" height="25"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[Total companies_name]]></text> </staticText> </cellContents> </crosstabTotalRowHeader> </rowGroup> <columnGroup name="USER_NAME" height="30" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$V{USER_NAME}]]></bucketExpression> </bucket> <crosstabColumnHeader> <cellContents backcolor="#F0F8FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/> <textElement/> <textFieldExpression><![CDATA[$V{USER_NAME}]]></textFieldExpression> </textField> </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <staticText> <reportElement x="0" y="0" width="50" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[Company T]]></text> </staticText> </cellContents> </crosstabTotalColumnHeader> </columnGroup> <measure name="conformance_tasks_estimated_hoursMeasure" class="java.math.BigDecimal" calculation="Sum"> <measureExpression><![CDATA[$F{conformance_tasks_estimated_hours}]]></measureExpression> </measure> <crosstabCell width="50" height="25"> <cellContents> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{conformance_tasks_estimated_hoursMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell height="25" rowTotalGroup="companies_name"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{conformance_tasks_estimated_hoursMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="50" columnTotalGroup="USER_NAME"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{conformance_tasks_estimated_hoursMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell rowTotalGroup="companies_name" columnTotalGroup="USER_NAME"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{conformance_tasks_estimated_hoursMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> </crosstab> </band> </summary> Link to comment Share on other sites More sharing options...
Teodor Danciu Posted September 21, 2012 Share Posted September 21, 2012 Hi, I your question more about how to add a new text field in each table cell, or is it about how to calculate the percentage? Thanks, 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