Jasper Reports — those empty reports.

Jasper reports is a wonderful product .. and it does integrate really nicely with netbeans. But when it goes wrong you can get blank reports with no clue to what the problem is.

Here are some short observations when coding it up with java and JSF that might help you.

1. Watch your field names - I noticed that when you generated reports Jasper Reports writes a pretty odd query especially with SQL server 2000 at the back end (yes I know, some people still use it, although this one WILL be upgraded to MYSQL):-

SELECT
     tblZones.”ZoneDescription” AS tblZones_ZoneDescription
FROM
     “dbo”.”tblZones” tblZones
ORDER BY
  tblZones.”ZoneDescription

Now this is fine - so then the fields in the report are mapped to tblZones_ZoneDescription intead of just leaving it as is - so if you then have a custom query for the report make sure that you are using the right field names or you could get that “blank page thing”

2. Main/Subforms or header/details (you know, Purchase Order Header and lines) - getting sub forms to work is hard graft! - I will post a solution when we do it - but until then it’s easier to have a SINGLE query with a join have the lines in the detail and group by the header id.

3. When it all goes wrong - sometimes I’ve had it refusing to run the jasper reports report I created earlier in good Blue Peter fashion. Normally a restart of NetBeans does fix this - but sometimes I’ve found a CHKDSK.

4. BACK IT UP - EVERYONE who develops should use a repository system such as subversion or CVS it’s saved my life countless times.

Have fun!

Leave a Reply