I am beginner in jasper reports. I have creates simple reports to start with where i am using spring with jasper report. Here i did pass
the datasource(as JRBeanCollectionDataSource) under parameter map to jasper template where i am displaying user records. Work great.
Now on click off addess under main report, i want to display deatiled address report(kind of drill down report) . What i want is
pass the userdId from main report to my web application(hosted on tomcat) which fetches the address data and pass it on to
drill down address report template(something i did it for main report).
But i did not get any example related to it.Any help here ?
Some links suggest :-
1) I need to download JasperReport server. Is it mandatory ?
2) Some half baked examples make use of query from report template. What if i need to pass the data from java based on id passed
from main report?
1 Answer:
Hi Emilly,
There are two ways to achieve what you are intending to do.
1) using Sub Reports : Here you can create two reports.
a) A main report where you will fetch User Records.
b) A Sub Report where you will fetch Address Data with a parameter "User Id"
c) Connect Main Report with Sub Report with this parameter and you will have your desired output. For more info on how to create sub report please refer http://www.rajeshsirsikar.com/329/
2) Using JasperServer.
a) Create Two Reports as explained in the Previous example.
b) Publish both Reports in Jasperserver.
c) Cretae a Hyperlink to Userid Field in the main report with Parameter as Userid and link it to Sub Report.
Hopefully this helps!!!
Thanks,
Rajesh Sirsikar
Rajesh looks like second way is the ideal way for drill down reports. Few questions on this :-
1) Is Jasperserver a webserver like tomcat or something else ?
2)Do i need community or commercial edition of server for this ?
3)How sub report will fetch the address data based on userId passed from main report. One way is writing query on sub report
template. But is there a way that my java application pass on the data to subreport based on userId(like i did it for main report)?
1) Yes. Jasperserver is a webserver. It is teh central repository of jaspersoft. here you can Cretae Datasources, Dashboards, Schedule Reports, Create Control Inputs and lots more.
2) You can achieve your requirement using Community edition itself.
3) In Jasperserver, drill down means connecting your one report to another report or webpage or document which will open in a seperate page. So you can create a connection directly to your web page and provide the parameter as Userid.
Rajesh I need to incorporate this report feature in my java application. Is there a way i can call published report from my java java application say from some jsp page?
Rajesh, Can't i hit my java application from hyperlink URL and return filled report as response from server? Also can my java application
call published reports on jasper server and display it in browser?
Hey Emilly,
Watch this video. This will give you a clear picture of how to run y\jaser reports using java app.
https://www.youtube.com/watch?v=HpO3qotpxNg
Thanks,
Rajesh S