How to generate a dynamic report in java - java

I am doing a project for a clinical laboratory. I am using java, hibernate and SQL Server for my project. In some cases I need to generate reports on results of the particular Lab tests, for each tests the format of report differs.It is impossible to create predesigned forms for all the tests. So in this case the freedom of designing the form for test report should be given to the user of the application and this report format is mapped to each tests, so that when the application runs the report should be generated dynamically according to the mapped report format of the test. Can anyone help me to suggest a method for doing this(Here the report format is designed by user by using drag and drop facility, because the user is not technically skilled to do it by coding.The designed form can be mapped to a particular test by the user and the report is generated according to the uploaded format by filling the data of particular test taken from database). Thanks in advance.

Microsoft SQL Server provides a reporting service component (SSRS). Reports could be designed by the user in a desktop tool called Business Intelligence Studio*. This tool allows the user to drag and drop UI components to generate a template file. The template file contains two important details - data source details to fetch data & the format of the report to be displayed.
The template file is then uploaded on the report server. A report is generated from this template dynamically when needed. Dynamically here refers to the fact that the data to be displayed in the report is fetched at runtime when the request for report generation is made.
The template file can also accept Report Parameters which could help to generate multiple variants of the report for one template file. There are various other SSRS features which you could browse through.
SSRS dynamically report generation capability seems to suit the requirements you mention above.
SSRS also has exposes web services through you can integrate your application with SSRS. There are web service methods for uploading a template and rendering a report.
*There are web based alternatives too. One of them is cizer.

Related

Avoid Data Cache after generating report with embedded Pentaho Report Designer Classic Engine

I'm using Vaadin 6.8 and pentaho classic engine 5.0.1 embedded to my application. I've successfully generated the reports in the formats required and with parameters established. The issue comes when I noticed that after generating the report, there is something like a data-cache that doesn't allow me to get updated data from the datasource (MySQL jdbc in report definition). The report generator is generating new files, but the data is not updated because of this cache, it means that, different files are generated with the same data content, even when I update it directly in the database. I'm forced to close my vaadin application and generate the reports again to get the update on the report data, but I cannot close the user session every time to get it working as requirement.
After many days I've found this, where it explains that disabling data-cache is enough to avoid that problem:
http://forums.pentaho.com/showthread.php?82765-Engine-3-8-disable-data-caching
I've tried to set that config-key via my java classes, but I don't know how to set that key, so I decided to search more about this, and in the next link, says that is possible but using a BI-server.:
http://infocenter.pentaho.com/help/index.jsp?topic=%2Fperformance_tuning_guide%2Ftopic_reporting_caching.html
My application runs alone in a server, and I can't use the BI-server as I only need the report generator, that's the purpose of using embedded report generator. How can I set that config-key via Java classes or in a way that I can handle all in my Java application? or how can I avoid data-cache on report generation with classic engine?
The only way I've found to avoid data-cache without a global config-key is to define data-cache = false at Pentaho 's Report Designer Master Report attributes while editing a report.

Reporting framework for Java spring web application

Am working on a java spring web application. I want to implement reporting features for it. the main feature i want to implement in reporting is that i should be able to select some parameters. depending on that the reports should be generated. Parameter selection mean: i select 2 dates and the report should be generated for the data within those 2 dates. this is just an example. can anyone suggest me on what i should be using?
Taking off from your question in the comments section on using parameters in JasperReports:
4.1. Parameters
Parameters are useful for passing data to the report engine that it can not find > in its data source or when data changes depending on different runtime > > conditions.
We can also change portions or even the entire SQL query with parameters received > in the report filling operation.
The section 4.1 of blog should help you with creating a query statement with the parameters.

Configuring & Generating BIRT Reports Dynamically

From watching the 2-part YouTube videos and perusing the BIRT manual, my understanding of it is the the worflow goes something like this:
Create a new Report in Eclipse
Use the BIRT Report Designer (Eclipse plug-in) to design a report
Populate the report with Data Sources (JDBC drivers & databases) and Data Sets (specific tables)
Generate/export/print the report
As cool as this tool seems to be, I cannot find any documentation that leads me to believe that this is a Java tool and not an Eclipse-only tool (meaning, it has a Java API and can interact with Java apps, as opposed to a pure Eclipe plug-in which requires manual/human interaction from the Eclipse IDE.
Specifically, I want to confirm that BIRT either can or cannot do the following:
Configure a report (layout, UI widget placement, data sources/sets, etc.) programmatically; i.e. in the same way that JasperReport API has the iReport designer that generates JRXML, is the same true for BIRT?
Kick off a report "generation" through a Java API whereby data gets read-in realtime and populates the report and the report can be sent out or stored on a file system
Create HTML and PDF versions of the same report
Answers to your questions:
Yes. BIRT may not be as powerful as JasperReports, but it can achieve most of the common needs.
BIRT designer generates a .rptdesign file similar to JRXML in JasperReports.
About your question: almost everything is possible to achieve programmatically in BIRT. BIRT Report Engine APIs is the best source for you to get started with all the functionalities you have mentioned. It has good examples given for every functionality.
Not sure. BIRT usually fetches pre-saved data from DB and generates the report. You could though see the real time data representation (in the form of a flash chart may be) with the help of some external libraries (See if this thread and this example helps). But I am not aware of a direct way of converting the real time data to PDF/HTML report. You will have to find some hack(s).
Yes of course. Refer the APIs. To be specific, irendertask.
Sources to get more information/answers:
There are several example reports given on the website. A quick glance through them might give you more insights.
For discussions and troubleshooting, refer eclipse community forum and BIRTExchange (heavily used by BIRT users).
BIRT: A Field Guide to Reporting is an excellent book. I've used it myself from time to time.
I can confirm that the two BIRT components you are interested in using (BIRT Design Engine and Report Engine) will work in a pure-Java context and are deployable without Eclipse. I have deployed BIRT reports to run out of standalone Tomcat servers as well as Pentaho BI Server, and have exercised report definitions at the command line using shell scripts (no Eclipse involved).
Answers to your questions:
Configure a report programmatically: use the Design Engine API. I am not familiar with the Jasper Reports API so cannot comment on whether the BIRT method is similar, but the example code provides a good illustration. In particular, note lines 120-133 which add and manipulate widgets in the report, and how line 136 calls saveAs to save the report design file.
Generate a report in realtime: use the Report Engine. The sample code for the IRunAndRenderTask may be the most useful for you at first, but the engine has the ability to separate the data processing (extract and aggregate) of the report from the rendering and paging. I believe the examples focus on running reports from a Servlet, but it is easy to extract that logic from the servlet container logic.
Create both HTML and PDF versions: easily handled in the Report Engine via the IRenderTask. Once you've been through all the other setup work, changing the output format to produce PDF vs HTML is something of a joy. In my experience, it just works.
I found it useful to start out with a very simple Java class (adapted from the very old code here) to run a test report, called from the command line.
you can use the report engine API to configure reports:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#ireportrunnable
You can create HTML or PDF versions of a report by setting a variable in the url to generate the report or if using the report engine programmatically:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#irendertask
We use Eclipse to build and design reports. The report engine is deployed as part of a reports_war, the war has its own connection to the database. Our Java based web application uses urls to interact with the report templates (variables are set in the urls).
The BIRT Exchange is a good place for more information
There is not much difference between Birt and jasper as designing point of view except birt have eclipse plugin.
1)yes,you can configure it by java program or methods.
2)yes,this is possible.
3)yes again for export your report in different formats is easy for birt report by java
BIRT is a good and easy tool fro report generating.
you can design your pages in BIRT.
-
Create datasets and can pass the values from your web pages to your BIRT design using jsp tag lib.
BIRT fulfills all your requirement. Its so easy to use. first i use jasper, then tried crystal atlast Birt gies the output.
tag lib
i refer this link to view BIRTVIEWVER in my web page. PDF creation is so perfect in BIRT. You can generate PDF, DOC, HTML also.
you can pass values to your birt . while creating dataset there is option for passing params.
to do all this you have to install BIRTREPORT inyour eclipse BIRT Report designer

simple cms - only to create/edit content and export it via jdbc or java api

(i even don't know if i need a cms)
what i need is: a simple web based way for a functional department to create/edit multilingual text documents (probably tagged with customizable semantic tags).
The containing Texts are used in an RIA showing statistical data and infos about it. This infos and other user visible Stings should be fully managed by functional department.
the destination of the this texts/documents is an embedded apache derby db - delivered together with RIA release (as zip-File,- the texts are static).
So on the other hand the cms (if this is an cms) should provide an interface to export the data - either a simple db-structure to get data via jdbc or a java api.
so what cmc/?? do you suggest for this usecase
thx in advance
Maybe you could use a java web framework like Tapestry to create a simple web application.
It has some premade components too easily modify and save data to a database.

How do I combine multiple BIRT reports

We currently have a whole suite of report designs that cover various parts of our app, and these reports are generated on demand by our users.
I want to be able to bundle up several of these reports into a single report to return to the user.
I initially hacked up a custom report builder that generated report design files using segments inside a report library file, and then ran that generated design, but this was unwieldy and a pain to manage as I had to duplicate the individual reports (still required) inside the report library file. Any changes to the stand-alone reports had to be duplicated in the library for the combined reports.
What I am really looking for is a way to specify several design files, have them all run, and then return a single file to the user, containing all the reports they selected.
This is a fairly common request, that we are working on but have not solved yet.
One approach that is not ideal that you can use today is to run each report and then combine the output from each rptdocument. BIRT-exchange has an example of this here for PDF and HTML. The problem is that the page numbering will not be correct and the TOC will not be right either.
The better approach is if there was a merge report engine task that would allow you to combine multiple rptdocuments into a single rptdocument with appropriate pagination and TOC. There is a bugzilla entry here that I hope to see in the 2.5 (June 2009) version of the product. If you are interested please have a look in and give your feedback.
Finally, one of the features that I would like to see in the product for 2009 is some refinement to the DesignEngine API that allows a developer to easily compose a single report design at runtime, using components from other report designs. I have created a bugzilla to track this too.
If none of these seem appropriate let me know and I will see if I can help you find a different solution.

Categories