Using a Jasper Report Book

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

Using a Jasper Report Book

Postby wes.s.grayson » Mon Oct 03, 2016 11:52 pm

Hello,
I have a Jasper "Report Book" created in JasperStudio. The book contains book_cover.jasper, table_of_contents.jasper, and two custom reports. This works great when I preview it in JasperStudio. When I copy all these files to my servoy server into the application_server\server\reports directory and attempt to run the report, I get "Resource not found at: book_cover.jasper.".

I'm running the report in Servoy using the code below.

Code: Select all
function compileReport(event) {
   application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
   ds = forms.input1.foundset.getDataSource();
   var d = ds.split('/');
   var myServer = d[1];
   
   //run this jasper report and pass the ssp_id as the parameter.
   plugins.jasperPluginRMI.runReport(myServer, "My_Book.jasper", "c:\\temp\\my_book.pdf" , OUTPUT_FORMAT.PDF, {unique_id: forms.input1.unique_id});
   
   //launch PDF file in Adobe Reader
   application.executeProgram('rundll32', 'url.dll,FileProtocolHandler', 'c:/temp/my_book.pdf');


Instead of trying to run My_Book.jasper, if I replace that with book_cover.jasper, the cover page opens right up. So I know it's there in the right folder.

What do I need to do differently to run a report book?

thanks!
wes.s.grayson
 
Posts: 46
Joined: Mon Jan 23, 2012 5:39 pm

Re: Using a Jasper Report Book

Postby wes.s.grayson » Wed Oct 05, 2016 5:10 pm

I resolved this by typing in the full path names to all reports in the source code within JasperStudio

c:\\servoy\\application_server\\server\\reports\\book_cover.jasper
wes.s.grayson
 
Posts: 46
Joined: Mon Jan 23, 2012 5:39 pm

Re: Using a Jasper Report Book

Postby sbutler » Thu Oct 06, 2016 4:45 pm

Glad you figured it out, but full paths are kind of a pain to manage. Usually with subreports, my paths look like this:

Code: Select all
$P{SUBREPORT_DIR} + “myreport.jasper”


Also, if you are using Foundset based reports, you'll need to use the special resource loader: https://www.servoyforge.net/projects/se ... Guidelines
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Using a Jasper Report Book

Postby achiary » Mon Oct 10, 2016 3:55 pm

As Scott said : it is related to SUBREPORT_DIR setting.

If you use subreports you must set SUBREPORT_DIR parameter, relative to the directory defined in the Application Server for the plugin, for example :

"books/"

Also, In the Summary Section, for each subreport you should define for example :

$P{SUBREPORT_DIR} + "table_of_contents.jasper"

Doing this way you avoid full pathnames.
achiary
 
Posts: 83
Joined: Wed Nov 14, 2007 3:29 pm
Location: Argentina


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 13 guests