Running Pre Designed Reports

0
By: steveT - stevetucknott Running Pre Designed Reports 2005-07-23 04:16 Apologies up front if the question appears banal. We have been using iReport to design reports - that's fine. iReport then allows the report to be run and the output viewed - again fine. The snag is that we do not want the users to have to go into the 'design' tool to run their reports and there is not the ability to pass through the report name/output format in iReport (ie iReport.sh --reportname blah --outputformat blah) We are not 'Java' people per se (we have touched on the language) - so what we're after is advice/guidance on how we can now run/view/print the pre designed Jasper reports without having to enter the designer (ie a batch/command). Any advice would be appreciated. By: steveT - stevetucknott RE: Running Pre Designed Reports 2005-07-25 08:32 OK, so it would appear that this issue hasn't arisen before... To get around the issue I have now started to build a Java app that runs a predefined (via iReport) report. This is going ok, but I now have a question on parameters. One of the reports I have has two parameters (promptable) passed to it - when run via iReport (presumably) iReport prompts for the parameters (I'm a bit grey here as to the functionality of iReports compared to Jasper). So the question is, if iReport is the tool that is performing the prompting, what functionality is there in Jasper to identify the parameters used in a report, so I can start to build my own (dynamic) prompt routines? I have looked at the Jasper API docs and can see a JRParameter method, but I can't understand how this would enable me to get any parameters used. Any help would be appreciated. Thanks. By: C-Box - c-box RE: Running Pre Designed Reports 2005-07-25 22:54 Well you should perhaps start with looking at the samples JasperReports provides with the full download-package. You needn't IReport to run your predesigned reports... that's not very clever. IReport is a designer for JasperReports... so if you are ready with designing you can use these reports in your application with the methods JasperReports provided. IReport is just needed again, if you want to change the design (and even that is possible with the JasperReports-API - but therefore IReport is much more comfortable) As I already said, the best way is to take a look in the samples. In few words I can tell you the steps that are usually necessary to run a report: 1.) load your already compiled report (*.jasper file) into a JasperReport-Object (if you don't have such a .jasper file you must load your .jrxml and compile it) 2.) create a parameter-map (if needed) to transfer parameters from outside to the JasperReports-Engine 3.) create a DataSource or a Connection to your DataBase 4.) fill that report and get a JRPrint-Object 5.) show that JRPrint-Object in Viewer or export it to PDF, CSV, HTML or what else. I hope it comes a bit clearer... but I guess you are in a hurry and don't have time to search the forum(s) or to studied the samples!??!?!? hth C-Box By: steveT - stevetucknott RE: Running Pre Designed Reports 2005-07-26 00:39 C-Box thanks for the reply. You have to realise two things: 1) I'm not a Java expert 2) I started with iReports - that bundles Jasper, so at that stage I had no real knowledge of where one products functionality stopped and the other's started. So, I had no exposure to Jasper per se - I just have an installed jar. I have read all through the documentation on the Jasper site...but you have to be Java conversant to understand it. I just wanted a reporting tool that end users could use to 1) potentially design reports or (more probably) 2) run pre designed reports - without having to know an underlying programming language - does that make sense? I just assumed (obviously incorrectly) that the requirement to run a pre designed report was a common requirement and would have been part of 'base' -either as a pass through from iReport, or part of Jasper. Now I know that this functionality is not provided, and the only way of doing it is to write a Java application - which I'm doing - and hence the question on parameters (I had something working on points 3,4,5 - mainly by hard coding parameter entries). Thanks for the confirmation with regards to the parameters - I had come to the conclusion last night that the only way to get to them was through a report object (but again, being Java 'inexperienced', this is a long process) - so I have now bolted a compile into my code - but one issue leads to the next and now my issue is how to input the parameter values in the correct format (ie Integers, text, dates etc) (and I have searched on the net to see how to do this, but this appears to be a nightmare - I have a working JOptionPane working to input text, but the data conversion seems a bit long winded) - just seems so odd to me to be writing something that everyone must have to write - seems a bit like reinventing the wheel. Anyway, thanks again for the pointers/help. At least I haven't gone off at a completely screwed tangent! By: C-Box - c-box RE: Running Pre Designed Reports 2005-07-26 01:13 It makes sense... so you can use IReport for that purpose... just open the report and press the "RunButton".... if there are some parameters with "IsForPrompting" the dialog appears waiting for the user input. Of course 20 parameters = 20 Dialogs.... perhaps Giulio (author of IReport) changes it, to a kind of "ParameterWizard" that is just one dialog with a "< previus" and "next >" button or a list of all parameters to enter at once. But anyway... there isn't a predefined solution for EVERYONE ..... I also would have some features within IReport that doesn't exists...but therefore the "FeatureRequest" exist. :-) Good luck C-Box By: steveT - stevetucknott RE: Running Pre Designed Reports 2005-07-27 02:45 Just in case anyone has the same problem .... I have now written a small Java app (the code is appalling as I'm not a Java programmer) that will run a predesigned report and either/and/or preview it or format an output file (pdf,html etc). It picks up any parameters required by the report and prompts the user for the values. If anyone is interested, contact me off list.
2004 IR Help's picture
Joined: Aug 17 2006 - 3:49am
Last seen: 8 years 1 month ago

1 Answer:

0

 Hi,

       I know this thread was years ago, but I am having the same problem.  I am trying to make a report that should prompt when paramaters needed to be prompted.  Not in iReport but in a separate Java application.  I would like to ask about your solution/code, but I do not know how to contact you.  You help and advice will be very much appreciated.  Thank you.

Regards,

Jan

leunajyee's picture
Joined: Oct 4 2011 - 7:55am
Last seen: 1 year 7 months ago
Feedback