Jump to content
We've recently updated our Privacy Statement, available here ×

Adding extra Totals Columns on a crosstab


beard9982

Recommended Posts

I have a cross tab, nice and simple

Row Group   Company Name

Column Groups user_name

Measures  $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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...