Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crosstab with no totals

In JasperReports (using Jaspersoft Studio), is there a way to show contents without including totals?

enter image description here

I have the crosstab code here. If I delete the lines were appear <crosstabTotalRowHeader> and <crosstabTotalColumnHeader>, the cross tab keeps showing a total column, the one that does not have a header. I need to delete that column.

<crosstab>
    <reportElement x="0" y="0" width="442" height="240" uuid="aae99187-4857-48ad-b2c6-6a66c5e6e89a"/>
    <crosstabDataset>
        <dataset>
            <datasetRun subDataset="grafica_perspectiva" uuid="a819174c-e145-4ad4-a3ef-cddde875ceab">
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            </datasetRun>
        </dataset>
    </crosstabDataset>
    <rowGroup name="perspectiva1" width="60" totalPosition="End">
        <bucket class="java.lang.String">
            <bucketExpression><![CDATA[$F{perspectiva}]]></bucketExpression>
        </bucket>
        <crosstabRowHeader>
            <cellContents mode="Opaque" style="Crosstab_CH">
                <textField>
                    <reportElement x="0" y="0" width="60" height="20" forecolor="#FFFFFF"
                                   uuid="ff8ba239-2c96-4959-8d57-5751f1e67ce1"/>
                    <textFieldExpression><![CDATA[$V{perspectiva1}]]></textFieldExpression>
                </textField>
            </cellContents>
        </crosstabRowHeader>
        <crosstabTotalRowHeader>
            <cellContents/>
        </crosstabTotalRowHeader>
    </rowGroup>
    <columnGroup name="cot_nombre1" height="30" totalPosition="End">
        <bucket class="java.lang.String">
            <bucketExpression><![CDATA[$F{cot_nombre}]]></bucketExpression>
        </bucket>
        <crosstabColumnHeader>
            <cellContents mode="Opaque" style="Crosstab_CH">
                <textField>
                    <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="140" height="30"
                                   forecolor="#FFFFFF" uuid="76a9a21c-efed-4164-ab6c-4f91e2bf3903"/>
                    <textFieldExpression><![CDATA[$V{cot_nombre1}]]></textFieldExpression>
                </textField>
            </cellContents>
        </crosstabColumnHeader>
        <crosstabTotalColumnHeader>
            <cellContents/>
        </crosstabTotalColumnHeader>
    </columnGroup>
    <measure name="promedio_MEASURE1" class="java.lang.String">
        <measureExpression><![CDATA[new DecimalFormat("###0.00").format($F{promedio})]]></measureExpression>
    </measure>
    <crosstabCell width="140" height="20">
        <cellContents mode="Opaque" style="Crosstab_CD">
            <textField>
                <reportElement x="0" y="0" width="140" height="20" uuid="66c4a20e-d1d2-4263-8a1a-19b09f5d93fd"/>
                <textFieldExpression><![CDATA[$V{promedio_MEASURE1}]]></textFieldExpression>
            </textField>
        </cellContents>
    </crosstabCell>
    <crosstabCell width="140" height="20" rowTotalGroup="perspectiva1">
        <cellContents mode="Opaque" style="Crosstab_CD">
            <box>
                <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
            </box>
        </cellContents>
    </crosstabCell>
</crosstab>
like image 767
dovahkiin Avatar asked Mar 20 '23 03:03

dovahkiin


2 Answers

Never mind. To prevent showing a total column/row in a crosstab, ensure totalPosition attribute in columnGroup/rowGroup is equal to None.

like image 80
dovahkiin Avatar answered Apr 25 '23 15:04

dovahkiin


I was looking for a way to do exactly the same thing in Jaspersoft Studio 5.6.

Click on the Crosstab tab beside the Main report tab

enter image description here

Then, in the Outline window for the report, open the crosstab tree and the row groups.

enter image description here

Select the row group you want to set the total position attribute for and set it's value to None in the property window, the cell tab.

enter image description here

Done.

like image 45
user215556 Avatar answered Apr 25 '23 13:04

user215556