Sharing my experiences with Jasper Reports and iReport

Questions and answers on developing, deploying and using plugins and JavaBeans

Sharing my experiences with Jasper Reports and iReport

Postby mstokoe0990 » Mon Mar 18, 2013 12:34 pm

I have recently been spending a lot of time using Jasper Reports and building rather complex reports, more specifically with Jaspersoft's iReport.
I've dealt with passing in multiple parameters, using them in field expressions and in the SQL queries.
I'm not looking for solutions here as I've found fixes for almost every issue (Some of them quite easy fixes as well), but I thought I'd share my experience so that some people could learn from the gotchas and mistakes that I've had to learn from.
Working on Jasper Reports has been quite a trial-by-fire for me, my employer has asked me to build around 20-30 reports and as I said, some of them are quite complex. Most of them have just consisted of a few fields in the detail section, but the bigger, more complex ones are around 60-70 fields in, which is where Jasper has it's short-comings. As I've had to change my SQL statements and manually type in every field. (Due to various issues with datatyping and making sure that datatypes can be changed in the database and not have to change the reports again.)

For example:
I've got a table called 'tableA' with the columns 'PK', 'Time', 'Name', and 'valueX'
PK is an integer, primary key of the table.
Time is set as a DateTime (java.sql.Timestamp)
Name is a VARCHAR(255) field
valueX is another VARCHAR, but it's length is set to MAX

These four fields are the only ones on the report, so it'll be easy enough, right?
The SQL statement is simply going to be
Code: Select all
SELECT * FROM tableA

and now I'll be able to just shove some fields on the report.

So I go ahead and run that report and an exception will be thrown.
"java.io.NotSerializableException: net.sourceforge.jtds.jdbc.ClobImpl"

What the hell, right?. Well so far I've found that I'd get this every time anything is cast in the SQL as VARCHAR(), or VARCHAR(MAX). Which is a major annoyance, because my application requires those fields to be max length, I can't change the length of the fields, so it's now got to be done in the SQL.

My statement now becomes this:
Code: Select all
SELECT
PK,
Time,
Name,
CAST(valueX AS VARCHAR(1000))
FROM
tableA


Not necessarily '1000', but some other number, I usually use 1000.

So I run the report, now, it works just fine. But now a client requirement means I need to change a column's data type to a date.
So once I've changed the datatype in my database, my report breaks again.
My statement has to change... Again.

This time, I'm having to cast the date, too.
Code: Select all
SELECT
PK,
CAST(Time AS VARCHAR(1000)),
Name,
CAST(valueX AS VARCHAR(1000))
FROM
tableA


Everything works, regardless of the huge mess around I've had trying to get it to do so.

So my solution is ready for deployment, I export my solution and upload it to the app server, I transfer my report and any images I've used to make it look good, too.
All of the required plugins and beans are up, in particular, JasperReports bean and plugins.

I browse over to http://appserver.com:8080/ and check if it's working, download the JNLP and run it, head over to the report and try to run it.
Crashes and burns, something about uuids.
So I do quite a bit of digging around to found that the version of iReport I'm using is somehow too new, it's adding in a <uuid=""> attribute into everything I've got on the report.
I dig through the jrxml file and remove all instances of this tag, a simple regex in a decent text editor can do this for me, no big issue (Except figuring out why it was broken).
I upload the new versions of the reports and try to run them again.
I'm now getting a different error, about paragraph tags.
I've put some indentations on the text of some fields in the report and the version of the plugin I'm using doesn't like it.
So back in the jrxml, I remove all of the paragraph tags, again, easy enough with some regex (Also after figuring out the issue and how to fix it).

Back into the reports section, I run the report and finally, the report has worked!
But I notice something in the report that I need to change, so I go ahead and make the change in iReport and forget all about the uuids and paragraphs tagging issues.
I run the report again and it errors out, so I go digging through the settings and find the option for saving in compatibility mode for older versions, this solves both the uuid and paragraph tagging problems, which has now made things easy enough to save the reports for version 4.5.0, which is void of uuids and paragraph tags.

So why does Jasper have to be this fiddly? I had to spend hours trying to find the correct version of the plugin (Even though in the end it turned out the latest version was what I needed anyways.) and the correct version to save in compatibility mode with. Why doesn't the latest version of the plugin work with the latest version of iReport? Surely iReport can't just be adding in tags that can't be read by the plugin? There's been uuid issues since version 4.6.0 and we're up to 5.0.1 now.

Thanks for reading anyways, just thought I'd share my experiences with iReport/Jaser Reports and Servoy with anyone else that's having issues or who has had these issues in the past.
Michael Stokoe
(Version: 7.4.0 - Windows 8.1 - SQL Server 2008 R2)
mstokoe0990
 
Posts: 10
Joined: Thu Dec 13, 2012 10:26 am

Re: Sharing my experiences with Jasper Reports and iReport

Postby david » Tue Mar 19, 2013 4:39 pm

It's a mystery to me why anyone uses iReport/Jasper anymore. https://www.servoyforge.net/projects/velocity-report, end of story.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Sharing my experiences with Jasper Reports and iReport

Postby lwjwillemsen » Tue Mar 19, 2013 5:42 pm

We have several I-report report-designers at work for quite some time now who produced many, many jasper reports, some very complex.
We never encountered these casting issues up to now.

We are very happy with jasper reports, end of story.

Regards,
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby Hans Nieuwenhuis » Tue Mar 19, 2013 6:21 pm

+1
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby Harjo » Tue Mar 19, 2013 8:39 pm

david wrote:It's a mystery to me why anyone uses iReport/Jasper anymore. https://www.servoyforge.net/projects/velocity-report, end of story.

Sure, velocity has his purpose, but
did you try to build a pixel perfect invoice layout, with all the wishes of a client, like custom font embedding, multiple bands, sub, sub sub, summary, etc...

that's hell in Velocity, and a snap in iReport..
Harjo Kompagnie
byKom B.V.
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby david » Tue Mar 19, 2013 9:22 pm

Harjo wrote:
david wrote:It's a mystery to me why anyone uses iReport/Jasper anymore. https://www.servoyforge.net/projects/velocity-report, end of story.

Sure, velocity has his purpose, but
did you try to build a pixel perfect invoice layout, with all the wishes of a client, like custom font embedding, multiple bands, sub, sub sub, summary, etc...

that's hell in Velocity, and a snap in iReport..


I totally disagree :) Much easier to do with servoy server-side data generation, html templates and snippets, and css. And these are commonly available skills for new programmers and designers these days.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Sharing my experiences with Jasper Reports and iReport

Postby Harjo » Tue Mar 19, 2013 9:30 pm

I'm happy that you are happy :-)
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby ptalbot » Tue Mar 19, 2013 10:08 pm

Harjo wrote:
david wrote:It's a mystery to me why anyone uses iReport/Jasper anymore. https://www.servoyforge.net/projects/velocity-report, end of story.

Sure, velocity has his purpose, but
did you try to build a pixel perfect invoice layout, with all the wishes of a client, like custom font embedding, multiple bands, sub, sub sub, summary, etc...

that's hell in Velocity, and a snap in iReport..


@David:
For once I'm glad to say we totally agree! ;)

@Harjo:
Embedding custom fonts is dead easy in Velocity. Just put your ttf files in a /fonts subfolder of your /reports folder and push them using plugins.VelocityReport.installFonts() in your solution onOpen method (for Smart client, in Web client you don't even need that step), then you can use them in your CSS.

As to achieve pixel perfect layouts, you can use CSS positionning and precise width/height, so it's a matter of being efficient enough in HTML/CSS (which is pretty much a required skill nowadays), and definitely doable.

And "multiple bands, sub, sub sub, summary, etc" are done when you build your context, using either calcs/aggregates and/or simple Servoy looping + arithmetic in JavaScript and a few #if / #foreach in your templates, maybe you don't have a visual iReport group/band builder but it'S much more flexible than that and it's all Servoy based JavaScript so as long as you are efficient in Servoy/JavaScript you should be able to build pretty complex reports with any level of grouping in Velocity.

Hell! If you want, you can even embed in a straight Servoy form a little report layout builder and give that to your clients so that they can choose what to group on, and what level of details/columns they want along with various other ways to customize their reports, like I did for a client's project:

ReportLayoutBuilder.png
Report Layout Builder
ReportLayoutBuilder.png (44.42 KiB) Viewed 12215 times

Now try that with Jasper Reports...
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Sharing my experiences with Jasper Reports and iReport

Postby Harjo » Wed Mar 20, 2013 9:15 am

HI Patrick, thanks for this.

I know what Velocity does, and this Report builder you show, is very cool, but before we have build this in Servoy, I have my report finished in 10% of the time! :-)
Harjo Kompagnie
byKom B.V.
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby ROCLASI » Wed Mar 20, 2013 10:01 am

Harjo wrote:I know what Velocity does, and this Report builder you show, is very cool, but before we have build this in Servoy, I have my report finished in 10% of the time! :-)


Hmm...I think you are confusing creating a report with creating a report builder here. ;)

Anyway, I guess it all depends on what tool you know best. If you haven't worked with iReport then the editor is pretty daunting. Same goes for if you haven't worked with the Velocity Template Language (VTL) then this can be daunting too and on top of that you need to know how to work with (X)HTML and (optionally) CSS . But even for that last part there are nice GUI editors as well.

I for one prefer Velocity (and I even hand-code my CSS/HTML).
But perhaps an easy (for users) Velocity Report Builder might be an interesting ServoyForge project.
Any (part)takers ?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Sharing my experiences with Jasper Reports and iReport

Postby Kahuna » Wed Mar 20, 2013 10:34 am

ROCLASI wrote:But perhaps an easy (for users) Velocity Report Builder might be an interesting ServoyForge project.
Any (part)takers ?


That would be a great addition to the Velocity take-up and one we would support, perhaps even with a donation as contribution to the project!
(Servoy Version: 6.0.7 Win XP / 7 - SQL Server 2008 R2)
Ian Cordingley (Kahuna)
Kahuna
 
Posts: 1235
Joined: Thu Oct 26, 2006 1:39 am
Location: 1/2 NE UK 1/2 Olvera Spain

Re: Sharing my experiences with Jasper Reports and iReport

Postby Harjo » Wed Mar 20, 2013 12:37 pm

+1
Harjo Kompagnie
byKom B.V.
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby david » Wed Mar 20, 2013 3:55 pm

ROCLASI wrote:Anyway, I guess it all depends on what tool you know best. If you haven't worked with iReport then the editor is pretty daunting. Same goes for if you haven't worked with the Velocity Template Language (VTL) then this can be daunting too and on top of that you need to know how to work with (X)HTML and (optionally) CSS . But even for that last part there are nice GUI editors as well.

I for one prefer Velocity (and I even hand-code my CSS/HTML).


Velocity reports is technology everyone should be learning. It's basics skills now for new programmers and applies to many areas besides Velocity. It will even help your Servoy server-side javascript abilities. At least it has for us -- we're starting to code with patterns and tricks learned from the client-side world.

iReports/Jasper approach is fast until there is that one arcane thing that sucks 10 hours out of your day trying to figure out (happens with every tool). I'd rather invest that time on relavent additive technology. Figure something out in Velocity and it will help you out in many areas.

Getting your team ramped up in the Velocity approach has far more value that the iReport/Jasper approach in my opinion. And in the end, you are just as fast at building reports.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Sharing my experiences with Jasper Reports and iReport

Postby lwjwillemsen » Wed Mar 20, 2013 4:46 pm

Some defence points for Jasper :

1) I think a graphical report builder with a high level of WYSIWYG in terms of lay outing graphical elements is of great importance for a lot of users worldwide.
2) We pass the sql query from a foundset to the jasper engine and through the sql query in the jasper report we can get, sort, group etc. all data related to the foundset data we want
only for that one report. This gives understandable a lot of report power where we as Servoy developers are not involved; more time to drink coffee :D
I think that with Velocity all that data mining should be done in Servoy code ? Correct me if I'm wrong.

I find this discussion very valuable !

Regards,
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Sharing my experiences with Jasper Reports and iReport

Postby ptalbot » Wed Mar 20, 2013 5:02 pm

lwjwillemsen wrote:1) I think a graphical report builder with a high level of WYSIWYG in terms of lay outing graphical elements is of great importance for a lot of users worldwide.

Each time I hear that argument, I have a hard time picturing end-users digging into iReport: I've NEVER seen that in many years I've used JasperReport. It just doesn't happen... The truth is that you need to be a specialized report designer or a skilled developer to build reports, not a user.

As to passing a foundset SQL, I find that approach a waste: you realize that you've already queried the database once to get your foundset, right? And now you're going to query it again in Jasper using that method... Either pass the foundset or use Velocity and you'll get a boost in performance.
And yes in Velocity you would do that in Servoy - but you would drink your coffee while a HTML designer is doing your pretty template ;)
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Next

Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 1 guest

cron