title: How to avoid error incrementing crosstab dataset when trying to add pivot in jasper studio?
body: <p>I want to add a pivot (crosstab) in jasper report. When I add the pivot, I get an error when I download the file. I tried to debug with running the query and I don't have an error and I also try to debug with showing the parameter on the view, the parameter is show up without an error, I also try to show the result of query, and the data is show up. </p>
  
  <p>So what is my problem? and how to fix my code?. </p>
  
  <p><strong>detail band</strong></p>
  
  <pre><code>&lt;detail&gt;
      &lt;band height="230"&gt;
          &lt;crosstab&gt;
              &lt;reportElement x="167" y="30" width="200" height="200" uuid="b1977adf-e860-43cf-8940-fe4862f16621"/&gt;
              &lt;rowGroup name="KOMPETENSI1" width="60"&gt;
                  &lt;bucket class="java.lang.String"&gt;
                      &lt;bucketExpression&gt;&lt;![CDATA[$F{KOMPETENSI}]]&gt;&lt;/bucketExpression&gt;
                  &lt;/bucket&gt;
                  &lt;crosstabRowHeader&gt;
                      &lt;cellContents mode="Opaque" style="Crosstab_CH"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="60" height="20" uuid="72845a66-f743-4f35-8091-02df93de67d0"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$V{KOMPETENSI1}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabRowHeader&gt;
                  &lt;crosstabTotalRowHeader&gt;
                      &lt;cellContents&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="5792f3fa-1bb5-4134-91e1-b51918c05ec0"/&gt;
                              &lt;text&gt;&lt;![CDATA[Total KOMPETENSI1]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabTotalRowHeader&gt;
              &lt;/rowGroup&gt;
              &lt;columnGroup name="TAHUN1" height="20"&gt;
                  &lt;bucket class="java.lang.String"&gt;
                      &lt;bucketExpression&gt;&lt;![CDATA[$F{TAHUN}]]&gt;&lt;/bucketExpression&gt;
                  &lt;/bucket&gt;
                  &lt;crosstabColumnHeader&gt;
                      &lt;cellContents mode="Opaque" style="Crosstab_CH"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="60" height="20" uuid="fd89bbdf-eb6c-4c75-ab2c-9414ccd88458"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$V{TAHUN1}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabColumnHeader&gt;
                  &lt;crosstabTotalColumnHeader&gt;
                      &lt;cellContents&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="2d91db64-a9d7-43d3-b1c5-4c61412de5a1"/&gt;
                              &lt;text&gt;&lt;![CDATA[Total TAHUN1]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabTotalColumnHeader&gt;
              &lt;/columnGroup&gt;
              &lt;columnGroup name="JOB1" height="20"&gt;
                  &lt;bucket class="java.lang.String"&gt;
                      &lt;bucketExpression&gt;&lt;![CDATA[$F{JOB}]]&gt;&lt;/bucketExpression&gt;
                  &lt;/bucket&gt;
                  &lt;crosstabColumnHeader&gt;
                      &lt;cellContents mode="Opaque" style="Crosstab_CH"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="60" height="20" uuid="6adc10a6-8c28-4d17-bc6d-32727f7a8805"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$V{JOB1}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabColumnHeader&gt;
                  &lt;crosstabTotalColumnHeader&gt;
                      &lt;cellContents&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="fe8d03a8-5308-4845-b868-2b4cec45c2b5"/&gt;
                              &lt;text&gt;&lt;![CDATA[Total JOB1]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/cellContents&gt;
                  &lt;/crosstabTotalColumnHeader&gt;
              &lt;/columnGroup&gt;
              &lt;measure name="LEVEL_JOB_MEASURE1" class="java.lang.String"&gt;
                  &lt;measureExpression&gt;&lt;![CDATA[$F{LEVEL_JOB}]]&gt;&lt;/measureExpression&gt;
              &lt;/measure&gt;
              &lt;measure name="LEVEL_KOMPETENSI_MEASURE1" class="java.lang.String"&gt;
                  &lt;measureExpression&gt;&lt;![CDATA[$F{LEVEL_KOMPETENSI}]]&gt;&lt;/measureExpression&gt;
              &lt;/measure&gt;
              &lt;crosstabCell width="60" height="20"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CD"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" uuid="0e4ec703-4f2c-4389-bb9b-02a7f8df230e"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" uuid="8f49c8dc-e172-4407-ba54-6aa077591235"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
              &lt;crosstabCell width="60" height="20" columnTotalGroup="TAHUN1"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CT"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="78be64d3-2d78-411f-9d60-3b545311e376"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="47ac3c87-fee5-4e99-bade-9304180bdc2c"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
              &lt;crosstabCell width="60" height="20" columnTotalGroup="JOB1"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CG"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" uuid="94604b9b-36f7-4572-8c24-c48a538503b8"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" uuid="8f2f6f73-049e-45ae-9d5b-fe55abad0c24"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
              &lt;crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CT"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="41785b14-fc8f-4c85-928b-0df8555ffcb5"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="0cfec42f-0f33-46ff-9367-2c0c4978744c"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
              &lt;crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="TAHUN1"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CT"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="1081fcf5-f921-47a0-89c0-923b9be4fd73"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="0215fe30-2917-40a7-84d1-2cdac6216373"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
              &lt;crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="JOB1"&gt;
                  &lt;cellContents mode="Opaque" style="Crosstab_CT"&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="ba2855de-e2bf-4354-9c4f-67105912b4d7"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_JOB_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                      &lt;textField&gt;
                          &lt;reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="202c0fa6-308b-4a7e-9656-33eea6859d89"/&gt;
                          &lt;textFieldExpression&gt;&lt;![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]&gt;&lt;/textFieldExpression&gt;
                      &lt;/textField&gt;
                  &lt;/cellContents&gt;
              &lt;/crosstabCell&gt;
          &lt;/crosstab&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  </code></pre>
  
  <p><strong>Parameter definition:</strong></p>
  
  <pre><code>&lt;parameter name="pPersonId" class="java.lang.String"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="npp" class="java.lang.String"/&gt;
  </code></pre>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>&lt;queryString&gt;
      &lt;![CDATA[select CASE WHEN (JENJAB like 'SEVP') THEN '4' 
      WHEN (JENJAB like 'EVP') THEN '4' WHEN (JENJAB like 'SVP') THEN '4' 
      WHEN (JENJAB like 'SVP') THEN '4' WHEN (JENJAB like 'AVP') THEN '3' 
      WHEN (JENJAB like 'AVP') THEN '2' END AS LEVEL_JOB, kompetensi, 
      level_kompetensi, tahun, job from OL_ASSESSMENT_RESULT 
      where tahun in (select tahun from ( select distinct tahun  
      from OL_ASSESSMENT_RESULT order by tahun desc)  
      where ROWNUM &lt;=3 ) and npp = $P{npp}]]&gt;
  &lt;/queryString&gt;
  </code></pre>
  
  <p><strong>Field declaration:</strong></p>
  
  <pre><code>&lt;field name="KOMPETENSI" class="java.lang.String"/&gt;
  &lt;field name="LEVEL_JOB" class="java.lang.String"/&gt;
  &lt;field name="LEVEL_KOMPETENSI" class="java.lang.String"/&gt;
  &lt;field name="TAHUN" class="java.lang.String"/&gt;
  &lt;field name="JOB" class="java.lang.String"/&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>JRRuntimeException: Error incrementing crosstab dataset<br/>
      Caused by: JRException: <strong>Crosstab data has already been
    processed</strong></p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/w4TWC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w4TWC.jpg" alt="enter image description here"></a></p>