Mods to Jasper Plugin for Foundsets?

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

Mods to Jasper Plugin for Foundsets?

Postby Kahuna » Mon May 11, 2009 6:02 pm

After some chatter (admitedly started by me :oops: ) Patrick Talbot put quite a bit of effort into modifying the Jasper Plugin code (from the open source).

It seems his work allows the plugin to now use the Servoy foundset rather than having to recode the entire foundset SQL (which may be made up of multiple tableFilterParams in my case) in Jasper plugin call.

I think Patrick has offered to make this available to whoever is managing the Jasper Plugin on behalf of Servoy as per this thread:

viewtopic.php?f=15&t=12247

From a Servoy aspect It seems this would be a good thing, and only enhance the way Servoy can apply the Jasper Plugin. From a user viewpoint - having the Servoy stamp on it offers a comfort factor - and may result in even more enhancement of the plugin.

I recognise its extra work but is there any likelihood that someone from Servoy would take this work on-board on behalf of the user base?
(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: Mods to Jasper Plugin for Foundsets?

Postby IT2Be » Mon May 11, 2009 11:46 pm

I think this: http://code.google.com/p/servoy-jasperr ... Guidelines will help him/you to commit the changes to the group.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: Mods to Jasper Plugin for Foundsets?

Postby ptalbot » Tue May 12, 2009 4:36 am

IT2Be wrote:I think this: http://code.google.com/p/servoy-jasperr ... Guidelines will help him/you to commit the changes to the group.


I followed the guidelines and tried to be as unobstrusive as possible :
- there's only 2 method added to the IJasperReportsService interface, implemented in the JasperReportsServer class,
- of course, to avoid making dumb copy of he methods I had to do a little bit of refactoring to make my new methods use the same code as the one using the dbalias String,
- same thing for the JasperReportsProvider class, the patch is much bigger than expected because it didn't recongize the code in the refactored method, but there isn't much changed, really.

So since I am still unsure to whom I should submit this patch, you (and others) can find it attached.
Attachments
servoy_jasperreports.patch.zip
(6.72 KiB) Downloaded 229 times
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1613
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Mods to Jasper Plugin for Foundsets?

Postby rgansevles » Tue May 12, 2009 10:07 am

Patrick,

Can you show an example of a servoy method that uses this patched plugin?

I see you are collecting all data needed for the report and you are sending that to the server part of the plugin where the report is filled with this data.
I wonder how you determine which fields are required for the report.

Does this also support a report with grouping?
For instance a department report with the employees listed:

-- Sales
---- Anne
---- John
-- Marketing
---- Chris
---- Ellen

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1894
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Mods to Jasper Plugin for Foundsets?

Postby ptalbot » Tue May 12, 2009 4:06 pm

rgansevles wrote:Patrick,

Can you show an example of a servoy method that uses this patched plugin?

I see you are collecting all data needed for the report and you are sending that to the server part of the plugin where the report is filled with this data.
I wonder how you determine which fields are required for the report.

Does this also support a report with grouping?
For instance a department report with the employees listed:

-- Sales
---- Anne
---- John
-- Marketing
---- Chris
---- Ellen

Rob


Hi Rob,

While reviewing the sample solution below, I just noticed a problem with the patch I submitted yesterday (it was running late, so I didn't see this one, sorry), you will find a new version attached, but if you prefer you can edit, in the JasperReportsProvider.java file, the lines 375,376:
Code: Select all
           } else if (obj instanceof SerializableTableModel) {
              model = (SerializableTableModel)obj;

should read:
Code: Select all
           } else if (obj instanceof TableModel) {
              model = new SerializableTableModel((TableModel)obj);


About your question: in the attached archive, you will find a very simple solution based on the "udm" sample database. This solution contains one method demonstrating the use of my patched version. You will also find the jasper report (compiled for jasper 3.0.0 and along with the source), that should show you how I achieved grouping in the report.

Basically, I first convert my foundset to a dataset with convertToDataSet(foundset, array), where the array contains the field I want to retrieve (also works with related fields), then convert this dataset to a TableModel, using dataset.getAsTableModel(), then call the plugin with this dataset. There really is only 3 lines of significant code.

On the jasper report side, you will see that I have created fields with the same name as the fields I put in the array (including the relation and dot when applicable, for example "contacts_to_companies.company_name"), and then I created a group based on one of these fields (in my case "$F{contacts_to_companies.company_id}"), that's it!

To be able to test it, I did create a source on the udm database and made a query retrieving the same data with the same fields name, but this step is not necessary if you know what you are doing.

Hope this answer your question,
Attachments
jasperReportsFromAFoundSet.zip
sample solution, unzip, place in relevant folders and import solution
(78.96 KiB) Downloaded 227 times
servoy_jasperreports.patch.zip
Complete patch tested and reviewed for servoy_jasperreports plugin v2.1.6_beta
(6.87 KiB) Downloaded 216 times
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1613
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Mods to Jasper Plugin for Foundsets?

Postby rgansevles » Tue Jun 02, 2009 11:45 am

Patrick,

We have been working on the jasper reports plugin to allow reports on foundsets directly.
This is taking your work even a step further.

In classic servoy jasper reports, you have to duplicate the sql which is executed on the server.

In your approach you can collect record data (including related fields and calculations) in your reporting method and send the data to the server for processing.
The data is collected in the client and the report is processed in the server.
If the report changes (other fields are needed) you need to change the collection method as well.

Our next approach is to allow reports directly on foundsets.
In the report you can use fields, aggregates, related data, calculations.
You define the report on the foundset fields and simply pass the foundset in the run method if the plugin.
The report is executed on the client only.

I am planning to include both extensions into the next plugin version.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1894
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Mods to Jasper Plugin for Foundsets?

Postby Kahuna » Tue Jun 02, 2009 12:09 pm

rgansevles wrote:Patrick,

We have been working on the jasper reports plugin to allow reports on foundsets directly.
This is taking your work even a step further.

In classic servoy jasper reports, you have to duplicate the sql which is executed on the server.

In your approach you can collect record data (including related fields and calculations) in your reporting method and send the data to the server for processing.
The data is collected in the client and the report is processed in the server.
If the report changes (other fields are needed) you need to change the collection method as well.

Our next approach is to allow reports directly on foundsets.
In the report you can use fields, aggregates, related data, calculations.
You define the report on the foundset fields and simply pass the foundset in the run method if the plugin.
The report is executed on the client only.

I am planning to include both extensions into the next plugin version.

Rob


Rob - this is fantastic news and IMHO makes Jasper a really effective reporting tool for Servoy. Having to duplicate (and sometimes not really knowing what the SQL would be) the SQL to run a report made the Jasper plugin pretty much useless to us. I think the take-up of Jasper should soar with this functionality.

Thanks to Patrick for starting this ball rolling and to you Servoy guys for 'grasping the nettle' and adding this functionality.

When will this be available Rob?

It's exactly the right time for us as we're moving to final (and more complex) reports, as opposed to Servoy Forms as reports.
(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: Mods to Jasper Plugin for Foundsets?

Postby ptalbot » Tue Jun 02, 2009 8:24 pm

Rob,

I agrre with Kahuna, that's fantastic.
This will make the use of the JasperReport engine far more integrated and optimized for using in Servoy.

Thank you!
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1613
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Mods to Jasper Plugin for Foundsets?

Postby david » Tue Jun 02, 2009 8:32 pm

rgansevles wrote:Patrick,

We have been working on the jasper reports plugin to allow reports on foundsets directly.
This is taking your work even a step further.

...


Awesome! Looking forward to this.
David Workman, Kabootit

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

Re: Mods to Jasper Plugin for Foundsets?

Postby Thomas Parry » Tue Jun 02, 2009 9:55 pm

Sicne the code is on Google perhaps Servoy could consider beta testing of the changes to ensure the widest possible user base and the wildest possible usage mashups? I think David at Data Mosaic might agree to that concept?
Tom Parry
Prospect IT
Java/C++/Servoy/Jasper Reports/Simulation/Service Applications
http://www.prospect-saas.biz
Thomas Parry
 
Posts: 498
Joined: Thu Jan 10, 2008 8:48 pm
Location: Ottawa, Canada

Re: Mods to Jasper Plugin for Foundsets?

Postby ptalbot » Tue Jun 02, 2009 10:17 pm

I agree with you Tom,

Improving the integration with Jasper is a key improvement for complex reports, and Servoy need to provide a complete solution for this and open source and beta testing is the best way to ensure the largest possible coverage for the code.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1613
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Mods to Jasper Plugin for Foundsets?

Postby stefbrt » Wed Jun 03, 2009 10:43 am

This news is great and will help much. I'm looking forward to this and would help testing.

But when will this be available Rob?
Stefan Brecht
7r ag, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
stefbrt
 
Posts: 152
Joined: Wed May 06, 2009 9:32 am
Location: Switzerland

Re: Mods to Jasper Plugin for Foundsets?

Postby Harjo » Wed Jun 03, 2009 10:53 am

this is sooooo great! :D
Can't wait to try it.
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4296
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Mods to Jasper Plugin for Foundsets?

Postby rgansevles » Thu Jun 04, 2009 11:53 pm

I have commited the first alpha, see
http://groups.google.com/group/servoy-j ... ef2dc9ec86

Download here:

http://code.google.com/p/servoy-jasperr ... loads/list

Patrick, it also includes your patch.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1894
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Mods to Jasper Plugin for Foundsets?

Postby ptalbot » Fri Jun 05, 2009 3:54 am

Rob, you are the best! ;-)

Will try that in the following days.

Thanks again!
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
http://www.servoy-stuff.net
https://www.servoyforge.net
--------------------------------------------
Servoy 5.2.16 / 6.0.9 / 6.1.6 / 7.3.1
All OSes / Java 5 & 6 & 7
User avatar
ptalbot
 
Posts: 1613
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Next

Return to Discuss Feature Requests

Who is online

Users browsing this forum: MSN [Bot] and 1 guest

cron