Ejemplo de JasperReports con Vaadin

Saludos, este mi pobre blog está muy abandonado ;).
Pero acabo de escribir un ejemplo de un reporte de JasperReports con Vaadin, lo publiqué en el wiki de Vaadin:
Ejemplo en el wiki de Vaadin
Y el código está en sourceforge.net como siempre:
Código en sourceforge

Anuncios

Tercer capítulo del tutorial de JasperReports

Hola a todos, primero pedir disculpas si es que alguien sigue el tutorial de JasperReports, se que me demoré mucho en publicar este siguiente ejemplo, pero ya está aquí, es un ejemplo mas completo, usando una base de datos y utilizando el JRViewer.

Espero les sea de utilidad.

Ejemplo3: Reporte con datos

Espero sus comentarios.

Tutorial de JasperReports

Hola a todos, les cuento que al fin inicié el tutorial de JasperReports que tenía en mente hace un tiempo. 

El tutorial tiene la particularidad que se dedicará a ver el API de JasperReports, para así poder crear reportes usando el mismo.

Espero sea de ayuda, por ahora puse el primer ejemplo para irlo analizando, es algo básico y en él se explica cómo ejecutar un reporte.
Ir al tutorial

Problem with charts in JasperReports solved :)

Today (yesterday indeed) I am happy, I finally found the problem with the charts api in my code.

Some time ago (some years) I was working with JasperReports version 1.1.0. we (the team in my work) has implemented a web front end for reports, the user can configure his reports with the front end, i.e. select columns included in the report, grouping columns, totalizators, configure a chart and so on (obviously without knowledge of databases or sql, all in a web application).

As lead of the report engine, I used the JasperReports API, a really interesting technology, but not perfect yet.

The problem arise when we upgrade to the version 2.0.5 of JR, when the user want to generate a Chart in the first page (title band) of the report, the chart was correctly generated but only a few data of the report was generated (e.g. one page of three). Otherwise when the user want to generate the chart in the last page (summary band) then all the data of the report was correctly generated, but the chart was wrong rendered (only the title).

See the last below:

 

Chart problem

Chart problem

I posted in the JR forums without results. I has tried some changes in the code (evaluation times, reset types, etc), without results. I have updated to the version 3 of JR, but the problem continues and I can´t found something related in the release notes.

Finally today I start to review the problem again from the basics, I start to create a chart with a JRXML, then I found finally the problem.

I implemented a chart using a subDataSet and a dataSetRun, when the dataSetRun has the dataSourceExpression set to the report data source the problem arise.

Sample:
<pieChart>
   <chart isShowLegend="true" evaluationTime="Report">
      <reportElement x="50" y="0" width="200" height="200"/>
      <box>
         <pen lineWidth="1"/>
      </box>
      <chartTitle position="Top">
      <titleExpression>"My Pie chart"</titleExpression></chartTitle>
   </chart>
   <pieDataset>
      <dataset incrementType="None" >
         <datasetRun subDataset="chartSubDataSet">
            <dataSourceExpression>$P{REPORT_DATA_SOURCE}</dataSourceExpression>
         </datasetRun>
      </dataset>
      <keyExpression>$F{officeNumber}</keyExpression>
      <valueExpression>$V{chartOfficeGroup_COUNT}</valueExpression>
   </pieDataset>
   <piePlot><plot/></piePlot>
</pieChart>

Removing the dataSourceExpression from the chart definition solved the problem. In the code with the problem, I was passing all the parameters from the report parameters list (jasperDesign.getParametersList) including the REPORT_DATA_SOURCE, avoiding it, the problem was solved.

See below the correct chart:

 

Chart problem solved

Chart problem solved

I don´t expect to have a complete documentation for OSS libraries, but in this case should be a good time saver to get this chage log in some text file,  I think this problem can be a side effect, but the JR guys know it (I suspect ;).