Using a Jasper Report Book

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.

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!

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

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

$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

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.