Would anyone explain me how to add a data source to a "part" of a Report Book? - jasper-reports

I am trying to add a data source to a "part" of a Report Book. Or I should say passing the information to the fields on that "part" of the ReportBook( or why not, the Main Report). I have come to realize that this is not exactly how things were done with MainReport and Subreport(s). This is a new concept of jasper 6.2.0, so is not exactly the old known subreport and traditional way of doing things(or is it? Do not know..., please if you don't main, explain that too, thanks).
I have read a lot of examples out there ( see one here), of how to pass data source through jasper parameters and then, utilize those parameters referenced in , but it does not seem to be the same way when working with "parts" of a Report Book.
I can provide more information, but essentially what I need is to pass that data source to the part, that refer to my other report (or subreport if you will) named Content.jrxml, so the other report can print/render the right information of those fields. This report contains fields and no information is passing to those fields there went I print the Report Book to pdf. those fields are showing as null.
However I am able to pass parameters successfully is just with passing the fields values and the data source in general, which I have a problem
Does anyone have done or deal with this before or knows of a good example/tutorial that could point me to the solution?
Please help me, I don't know what else to do :(
Thanks in advance!

Sorry, it took me a long time to post back. I find a solution after Theodor (Jasper API main author give me some insights) and here is it!
So, for the Jasper Report engine to handle multiple data sources passed to the report, you have to take into account 2 essential things:
First, for every data source that you want to pass to the Report, you will need to create a new instance. Jasper engine consumes each data source iterating over all the elements in it. When it gets to the next page, there won't be any data, fields or information to read from and fill up the fields on that particular page. Therefore, information won't show up (null) or "blank", depending on the report template configuration.
Last, make sure you pass a new JREmptyDataSource() when filling the report and pass the data sources instance as parameters, and later as sub-parameters for each individual page. Like this:
jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter,new JREmptyDataSource() );//new JREmptyDataSource()
That way main report, or the wrapping report (the book), does not use any data source of the pages instances (if it does not need it, of course) and each page will get a data source, through the parameters.
Ultimately, on runtime, it the page of the book can consume individually each data source without affecting each other.
Let me know if this makes any sense?
Thanks

Related

Crystal report shows blank data

I have crystal report that was working before database upgrade. It is only one report that doesnt work. So I would not think of a driver issue.
I am able to test this report using CRs client tools, design and then preview. The preview does not bring any data. A single parameter is used and I am sure there is data because the data is retrieved if I create a new crystal report and also verified the SQL. (So there is no question about the no data or any missing links -- its a simple view).
This cannot be a driver issue as well, as all other old reports still work.
Have also tried deleting all the field's from the report, then add a single/simple new table and preview, still no data is showing.
Are there any logs inside crystal to investigate ? have tried ODBC.logs doesnt help as doesn't say what happens inside crystal reports after retrieving the data from database.
Thanks.
Zain
I've had this problem multiple times where my report comes up with empty fields. This may not be your cause, but what fixes it for me is to make sure that the dataset/table matches is referred to by the same name everyplace. In the xxxxxxDataset.xsd file, that table that's pictured should be the same name that's used in the function GetData() As System.Data.DataSet in your .NET object that uses the stored procedure to get the data. (You may call your function something other than GetData().) So try changing the ds.Tables(0).Tablename = "xxxxxxxTable" to match what the table in the xsd file is called.

How to show data from a sub report which has multiple source

I have a sub report in my main report which has a multiple source, actually 3 stored procedures. All of them have the same parameters and each brings back one row. The problem is that I can not get the data in preview. I also tried to make a PDF, but I am having the same problem, no data. Anyway, I tried also "Browse Data..." option in database fields and I can see the data there, the only place where I can see it.
Does anyone know what could be the issue? Maybe it is something with multiple sources.
Thanks in advance.
I would suggest you to create 3 subreports with one stored procedure each . There will be the same number of calls to the database , but Crystal engine will not try to figure the links between the datasources

Eclipse Birt Reports, Creating report from SQL database, (user key?)

I'm fairly new to using the Birt Report Designer and need to figure out how to generate a report from a SQLite database. I have suceeded in getting it to connect to the DB but am now unsure how to generate a report and the tutorials that I have found aren't of much help so far.
I have a template that was given to me by my employer that has a few fields, I'm wondering if these fieldnames (in the template) are supposed to match field names in the DB.
Also, when I go to Run->View Report-> As PDF I am unsure what I am supposed to enter for the field "User Key", does this correspond to a table name in the DB or something along these lines?
As of now, I have tried entering a table name but just a blank report is generated.
If anyone can point me to a good resource or help with this I would greatly appreciate it. Thanks
There are two books i could really advice:
BIRT - A Field Guide to Reporting
Integrating and Extending BIRT
and the Eclipse Help containing BIRT documentation.
I suppose the User Key could be report parameter (listed in Data Explorer window), which is passed to Data Set to select appropriate data. If I'm guessing right, check within a Data Set editor ("Parameters" tab and "Query" tab) where the User Key parameter goes in - probably to one of the table field in a WHERE clause. Parameters in a query are represented by question marks: SELECT * FROM fooTable WHERE barColumn = ?. Hope tracking this would lead to find out, what to enter to the parameter.
Additionally, ensure if your Data Set(s) is(are) connected correctly to your SQLite Data Source ("Data Source" tab in a Data Set editor).
Being as new as you are to BIRT, I would suggest building a couple of reports with the sample DB (Classic Models). There are many, many samples out there for you to use as a guide. Additionally, most tutorials will use the Classic Models data so you can follow right along. After you create a couple of practice reports (this should not take more than 30-45 minutes) the template you have been given will likely make A LOT more sense and allow you to make progress almost immediately.
If you are looking for a nice collection of tutorials and samples, be sure to check out Birt Exchange for Dev Share (samples) & tutorials.
As for the "User Key" this is almost certainly a report-level parameter used to filter the data set (as the previous answer points out).
Good Luck!

Composite reporting, Crystal Reports difficult to manage

I was wondering if someone had a suggestion on how to best do composite reporting.
I have tried to accomplish this with Crystal Reports [CR] (The one that comes with VS2k8) but for a codemonkey like me, it's hard to grasp the design part...
I have found that CR works nicely for reporting on tabular and repeatable data, but I can't grasp how to do what I want it to do.
What I want is a nice front-page, with title, subtitle and possibly some other text.
Maybe a TOC.
A summary report, consisting of some calculations and text-summaries calculated beforehand (not using the reporting tool).
Then a listing of one type of data, normal tabular.
Then another type of data, also tabular.
Then a drill-down on the first type of data. (Every "line" in the first type has 1..* associated items).
It looks to me like I have to do them all in separate reports, then "concatenate" the resulting reports to one another to get one report. And the front-page and the summary page I have no idea how to do at all.
Is there a better tool for doing this? Or does anyone have a good "quick-start" on composite reporting with CR? :)
EDIT: Oh, and these will only be used in printed-form. So no dynamic drill-down and such are necessary.
I create sub-reports and insert them into a footer section of the main report to create composite reports, using seperate reports as you suggest. I've searched myself, and failed to find any reasonable alternative. This approach works well enough and results in a single report file when done.
In my experience, Crystal is a pain in the butt for doing anything like a fixed page layout (ie: the title page). I usually put the title page in the report header (make sure to select "new page after" in the section options). Everything else pretty much has to go into subreports.
If you need to share totals and such between subreports, you need to use a shared variable in a formula field:
shared numbervar whateverTotal:= sum({whatever});
and then in the following reports, just use:
shared numbervar whateverTotal;

Difference between a report and a form

What's the difference between a report and a form?
In VB6, we have Data Report Designer to help with the creation of data reports.
I have not really used a report in my application yet. To me, it looks just like a form, but I think there must be some difference between them, or there is no need for the word "report" to exist?
Would someone please tell me the the difference between a report and a form?
A form is generally used to add/update/delete records.
A report is a readonly view of the data, you would like to see.
To give you a dumb example, you can assume a test question paper a form & a report card (which shows your grades), a report :)
A real example could be - when you borrow a book from the library, the software will use some sort of form to update the inventory & keep note of who the book is given to. A report in this example, could be - list of all books borrowed in this week.
Does that make it clear as mud?
A form is used to input data whereas a report is generated from the data that has been inputted.
Forms are for data entry - one record at a time.
Reports are for output - all relevant records.