How do I create a loop for subreports? - jasper-reports

Adding a subreport into a report with Java and Jasper Reports was easy enough, but I am having trouble making that subreport into something loopable.
The code in Java was simple enough: create report and loop through the parameters to generate subreports. The report generated at the end is a XLS file.
The hassle starts with Jasper Reports since the second iteration complains about the subreport datasource ID already being in use, but then if I generate dynamically the names in the Java code, the Jasper Report won't compile since the subreport's database name is fixed in the XML.
I could, in theory, just create several of the reports with a single subreport and then attach all of them together, but that doesn't feel optimal. How can I create the looped reports then? Is it some sort of parameter to be given in the XML from Jasper Reports or is it impossible to be done and I must use the multiple reports strategy instead?

Related

Order of execution of sub reports(linked and non linked) and main report in Crystal

I am new to crystal and want to understand the basics of subreports.Is it that main report is always executed before subreport?What if the subreport is placed in report/group header?If there are multiple subreports which are either linked or not linked to main report, what would be the order of execution in that case?Does it depend on positioning of report?
I have read many articles and got mixed responses. Please help me in understanding these concepts
Subreports are last to get processed in each section.
The key implication is that if you intend to pass a value from a subreport to the main report via a shared variable, you can't expect a formula in the same section to obtain that value. You must pass the value to a formula in a section below.

Best approach with Jasper Report

I have a requirement to generate reports in PDF and Excel format. For the same I have chosen Jasper. Now require some help from your side to identify the best approach on the same.
Note - My queries are dynamic in nature.Like in some scenario then will provide name in some scenario they will provide dates not name and in some scenario both.
Approaches I have identified are given below.
We can create data source and query in JRXML and execute the same.But not sure query will be dynamic or not. I am personally not prefer this approach because from java I can pass the connection from pool.
We can pass the query and connection both from the Java side and then Japser will execute the query.
We can query in java and then pass the List of bean to the Jasper for report creation.
Now need some suggestions on the best approach among above and also of any approach suggested apart from the above.
To me, option 3 is best. I did that previously.
For mine, I had a master report containing conditional sub-reports. To do that, I have build sub-report's .jasper from their .jrxml and passed my List of bean so that I don't have to re/compile the .jasper from .jrxml again(My master report was in .jrxml and condition for sub-reports where set there).
Another advantage is, you don't have to change your jasper files if you want to change your logic in query level-just leave them untouched once done.
So, I think , option 3 is good to go.

Execution of a subreport in jasper only once

I have a Jasper report which has multiple sub-reports, all of them have separate values. These reports are executed multiple times, is there a configuration I can make so I can execute a specific report only once?
Found the answer for the report
It was adding a page break and add a new subreport for the same

Create crystal report using dataset without using xsd file

I would like to ask if it is possible to create a crystal report using a dataset without using or creating an xsd file. Because there's one report here that does that. It is connected to a dataset but there's no xsd file that is used.
Of course you can, just use the report document's SetDataSource method :
YourReportDocument.SetDataSource(YourDS);

How to create reusable footers in SSRS 2008?

In my project I am already having a number of reports and also new reports are being created. Now I need to apply a common Footer (with page number, total page number, user name, report name and execution time) for all these reports. This footer has to be in such as way that we can modify it anytime (at a single place) and all the reports will get modified footer there after. Also the footer should be re-usable.
I have tried out approaches like
1) Creating a report and putting it inside the C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject - This allows the reusablility of the template. But if modified will not get applied to existing reports.
2) Creating sub-report and adding it to the end of the Data area in main report. This provides re-usablility as well as modifiable features. But not able to show Page Number, Total Page Numbers etc... and also not able to show the footer in each page of the report.
Can anyone give me some leads on how these features can be acheived?
Thanks
As far as I know this is not possible. Templating seems to be one of the main deficiencies of SSRS.
It's not ideal, but what you could possibly do is create an xsl stylesheet to process all of your RDL files and add/ update the footers.